From c4ee5d3e6972045d65a70aa4a1b146f211911551 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 12 Oct 2016 13:21:29 -0700 Subject: [PATCH] Autogenerate header dependencies Following http://scottmcpeak.com/autodepend/autodepend.html --- Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index faa4274..aeea12a 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,6 @@ man/tippecanoe.1: README.md PG= -ALL_H = $(shell find . '(' -name '*.h' -o -name '*.hpp' ')') H = $(wildcard *.h) $(wildcard *.hpp) C = $(wildcard *.c) $(wildcard *.cpp) @@ -59,14 +58,16 @@ tile-join: tile-join.o projection.o pool.o mbtiles.o mvt.o memfile.o unit: unit.o text.o $(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread -%.o: %.c $(ALL_H) - $(CC) $(PG) $(INCLUDES) $(FINAL_FLAGS) $(CFLAGS) -c -o $@ $< +-include $(wildcard *.d) -%.o: %.cpp $(ALL_H) - $(CXX) $(PG) $(INCLUDES) $(FINAL_FLAGS) $(CXXFLAGS) -c -o $@ $< +%.o: %.c + $(CC) -MMD $(PG) $(INCLUDES) $(FINAL_FLAGS) $(CFLAGS) -c -o $@ $< + +%.o: %.cpp + $(CXX) -MMD $(PG) $(INCLUDES) $(FINAL_FLAGS) $(CXXFLAGS) -c -o $@ $< clean: - rm -f tippecanoe *.o + rm -f tippecanoe *.o *.d indent: clang-format -i -style="{BasedOnStyle: Google, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, ColumnLimit: 0, ContinuationIndentWidth: 8, SpaceAfterCStyleCast: true, IndentCaseLabels: false, AllowShortBlocksOnASingleLine: false, AllowShortFunctionsOnASingleLine: false, SortIncludes: false}" $(C) $(H)