From 6f85b2aaf27467f55f60fd1337edef69ad530a6f Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Sun, 23 Jan 2022 18:31:04 -0500 Subject: [PATCH] Update Makefile to generate dependency info --- .gitignore | 2 ++ Makefile | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d78c7cd..5615e17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.o nk/*.o +*.d +nk/*.d ndhc diff --git a/Makefile b/Makefile index b706a4b..71e6dcd 100644 --- a/Makefile +++ b/Makefile @@ -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