Update Makefile to generate dependency info

This commit is contained in:
Nicholas J. Kain 2022-01-23 18:31:04 -05:00
parent 8db8c5589d
commit 6f85b2aaf2
2 changed files with 12 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
*.o
nk/*.o
*.d
nk/*.d
ndhc

View File

@ -1,14 +1,20 @@
NDHC_SRCS = $(sort $(wildcard *.c) $(wildcard nk/*.c)) ifchd-parse.c cfg.c
NDHC_SRCS = $(sort $(wildcard *.c) $(wildcard nk/*.c) ifchd-parse.c cfg.c)
NDHC_OBJS = $(NDHC_SRCS:.c=.o)
NDHC_DEP = $(NDHC_SRCS:.c=.d)
INCL = -I.
CC ?= gcc
CFLAGS = -O2 -s -std=gnu99 -pedantic -Wall -Wextra -Wimplicit-fallthrough=0 -Wformat=2 -Wformat-nonliteral -Wformat-security -Wshadow -Wpointer-arith -Wmissing-prototypes -Wunused-const-variable=0 -Wcast-qual -Wsign-conversion -D_GNU_SOURCE -DNK_USE_CAPABILITY -Wno-discarded-qualifiers
CFLAGS = -MMD -O2 -s -std=gnu99 -pedantic -Wall -Wextra -Wimplicit-fallthrough=0 -Wformat=2 -Wformat-nonliteral -Wformat-security -Wshadow -Wpointer-arith -Wmissing-prototypes -Wunused-const-variable=0 -Wcast-qual -Wsign-conversion -D_GNU_SOURCE -DNK_USE_CAPABILITY -Wno-discarded-qualifiers
-include $(NDHC_DEP)
all: ragel ndhc
clean:
rm -i *.o nk/*.o ndhc
rm -f $(NDHC_OBJS) $(NDHC_DEP) ndhc
cleanragel:
rm -f ifchd-parse.c cfg.c
ifchd-parse.c:
ragel -G2 -o ifchd-parse.c ifchd-parse.rl
@ -24,5 +30,5 @@ ragel: ifchd-parse.c cfg.c
ndhc: $(NDHC_OBJS)
$(CC) $(CFLAGS) $(INCL) -o $@ $^
.PHONY: all clean
.PHONY: all clean cleanragel