# define the commands we will use for compilation and library building CXX = gcc # define useful flags to cc/ld/etc. CFLAGS = -g -Wall -std=c11 # define common dependencies HEADERS = foo.h OBJS = foo.o bar.o foo: foo.o bar.o $(CXX) $(CFLAGS) -o foo $(OBJS) %.o: %.c $(HEADERS) $(CXX) $(CFLAGS) -c $< .PHONY: clean clean: /bin/rm -f *.o *~ foo