Issue
Simple question but I couldn't find any full answer online.
I have 3 projects, my desire outcome is that I run make and all 3 programs are transformed into executable files.
gcc -o server server.c
gcc -o server2 server2.c
gcc -o server3 server3.c
Is this achievable? How?
Solution
Thanks to @MadScientist for answering my question in the comments. I wish I could give him rep for this answer.
The Makefile that worked for me was
.PHONY: all server server2 server3
all: server server2 server3
server: server.c
gcc -o server server.c
server2: server2.c
gcc -o server2 server2.c
server3: server3.c
gcc -o server3 server3.c
After Makefile is created, enter make
in the command line to execute the 3 gcc commands.
By default make
will call make all
which in sort will call server, server2, server3 as defined on this line all: server server2 server3
.
I'm still not sure what .PHONY
is all about.
Answered By - Nicolasome