21 lines
379 B
Makefile
21 lines
379 B
Makefile
|
CPPFLAGS ?= -Werror -Wall -std=c99
|
||
|
|
||
|
program = test
|
||
|
sources = $(wildcard *.c)
|
||
|
objects = $(sources:%.c=%.o)
|
||
|
depends = $(sources:%.c=%.d)
|
||
|
|
||
|
%.d: %.c
|
||
|
@$(CPP) $(CPPFLAGS) -c -MP -MM -MT "$@ $*.o" $< >$@
|
||
|
|
||
|
$(program): $(objects)
|
||
|
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
||
|
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
rm -f $(program) $(objects) $(depends)
|
||
|
|
||
|
ifneq ($(MAKECMDGOALS),clean)
|
||
|
-include $(depends)
|
||
|
endif
|