CC=gcc CFLAGS=-Wall -Wextra -I. -I../llist OBJS=test.o hashtable.o llist.o all: test test: $(OBJS) $(CC) -o $@ $^ # Explicit recipes rather than VPATH: VPATH also searches for *targets*, so a # stale ../llist/test.o would get linked in place of this directory's own. test.o: test.c hashtable.h $(CC) $(CFLAGS) -c -o $@ $< hashtable.o: hashtable.c hashtable.h ../llist/llist.h $(CC) $(CFLAGS) -c -o $@ $< llist.o: ../llist/llist.c ../llist/llist.h $(CC) $(CFLAGS) -c -o $@ $< clean: rm -f $(OBJS) test .PHONY: all clean