Commit d212b608 authored by Mathieu Maret's avatar Mathieu Maret

Add Makefile example

This makefile check file dependecies (.h)
Idea from
https://github.com/rg3/darts/blob/5c644cfd35f10726453362e7dd0cf7a4742f52b0/Makefile
parent 8149222a
CXXFLAGS ?= -Werr -Wall
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment