diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2015-06-18 23:58:14 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2015-06-18 23:58:14 -0400 |
commit | 3748fa7d7a977f4e31c52ec8b4e66aa9e736342b (patch) | |
tree | 161563b4210df2c7070b14eff3198df5c6b319fb /Makefile | |
parent | ac11476e20136976bf689acf847fdcea4e05e37a (diff) | |
download | bfs-3748fa7d7a977f4e31c52ec8b4e66aa9e736342b.tar.xz |
Makefile: Auto-generate dependencies.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -10,19 +10,27 @@ ##################################################################### CC ?= gcc -CFLAGS ?= -std=c99 -g -Og -Wall -D_DEFAULT_SOURCE +CFLAGS ?= -g -Og -Wall LDFLAGS ?= +DEPFLAGS ?= -MD -MP -MF $(@:.o=.d) RM ?= rm -f -DEPS := bftw.h +LOCAL_CPPFLAGS := -D_DEFAULT_SOURCE +LOCAL_CFLAGS := -std=c99 + +ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS) +ALL_CFLAGS = $(ALL_CPPFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) $(DEPFLAGS) +ALL_LDFLAGS = $(LDFLAGS) bfs: bfs.o bftw.o - $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ + $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $^ -o $@ -%.o: %.c $(DEPS) - $(CC) $(CFLAGS) -c $< -o $@ +%.o: %.c + $(CC) $(ALL_CFLAGS) -c $< -o $@ clean: - $(RM) bfs *.o + $(RM) bfs *.o *.d .PHONY: clean + +-include $(wildcard *.d) |