Can anyone give me a makefile that creates 3 exe?for example, let's suppose i have the following files:
blah1.c
blah1.h
blah2.c
blah2.h
blah3.c
blah3.h
i've searched and searched but so far i was not able to complete it.
Can anyone give me a makefile that creates 3 exe?for example, let's suppose i have the following files:
blah1.c
blah1.h
blah2.c
blah2.h
blah3.c
blah3.h
i've searched and searched but so far i was not able to complete it.
Assuming you're using GNU make:
SRC=blah1.c blah2.c blah3.c
HDR=$(SRC:.c=.h)
OBJ=$(SRC:.c=.o)
PROG=$(SRC:.c=)
all: $(PROG)
$(PROG): $(OBJ)
gcc -Wall -ggdb -o $@ $@.o
.c.o: $(SRC) $(HDR)
gcc -Wall -ggdb -c $<
clean:
rm -f $(PROG) $(OBJ)
Adjust the compile options as needed.
can you explain that?what changes i need to do in your example above in order to make it work properly?sorry for asking again,but i just began using makefiles.
I meant that you'll probably have to change the lines invoking gcc to reflect the compile options you're using.
ok i think i got it.thank you!