c - Makefile doesn't clean object files -
c - Makefile doesn't clean object files -
here makefile:
objs = main.o hashfunction.o input.o list.o list_inverted_index.o memory.o operations.o sort.o source = main.c hashfunction.c input.c list.c list_inverted_index.c memory.c operations.c sort.c header = hashfunction.h input.h list.h list_inverted_index.h memory.h operations.h sort.h out = myexe cc = gcc flags = -g -c -wall # -g alternative enables debugging mode # -c flag generates object code separate files all: $(objs) $(cc) -g $(objs) -o $(out) # create/compile individual files >>separately<< main.o: main.c $(cc) $(flags) main.c hashfunction.o: hashfunction.c $(cc) $(flags) hashfunction.c input.o: input.c $(cc) $(flags) input.c list.o: list.c $(cc) $(flags) list.c list_inverted_index.o: list_inverted_index.c $(cc) $(flags) list_inverted_index.c memory.o: memory.c $(cc) $(flags) memory.c operations.o: operations.c $(cc) $(flags) operations.c sort.o: sort.c $(cc) $(flags) sort.c # clean house clean: rm -f $(objs) $(out) # bit of accounting count: wc $(source) $(header)
i tried append *.o
clean section (because of this answer), didn't work.
you should not need or want "clean object files". whole point of using make, don't clean remain dirty!
if want clean , start each build scratch, don't bother using make, write shell script instead.
c makefile
Comments
Post a Comment