Update the plain Makefile.

This commit is contained in:
Nicholas J. Kain 2020-10-20 07:18:19 -04:00
parent 1ba7c9a2ba
commit e6b5247d54
2 changed files with 6 additions and 5 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build/

View File

@ -13,9 +13,9 @@ OBJ_DIR = $(BUILD_DIR)/objs
CC = gcc CC = gcc
AR = ar AR = ar
CFLAGS = -O2 -s -std=gnu99 -pedantic -Wall -D_GNU_SOURCE CFLAGS = -O2 -s -std=gnu99 -pedantic -Wall -D_GNU_SOURCE
# Not required for glibc >= 2.17, but older glibcs are still common. # Not required for glibc >= 2.17.
# The CMake build script will perform detection, but this Makefile is simple. # The CMake build script will perform detection, but this Makefile is simple.
LINK_LIBS = -lrt #LINK_LIBS = -lrt
all: makedir ifchd-parse.o cfg.o ndhc all: makedir ifchd-parse.o cfg.o ndhc
@ -23,7 +23,7 @@ clean:
rm -Rf $(BUILD_DIR) rm -Rf $(BUILD_DIR)
makedir: makedir:
mkdir -p $(BUILD_DIR) $(OBJ_DIR)/src mkdir -p $(BUILD_DIR) $(OBJ_DIR)/src $(OBJ_DIR)/src/lib
ifchd-parse.o: ifchd-parse.o:
ragel -G2 -o $(BUILD_DIR)/ifchd-parse.c src/ifchd-parse.rl ragel -G2 -o $(BUILD_DIR)/ifchd-parse.c src/ifchd-parse.rl
@ -34,10 +34,10 @@ cfg.o:
$(CC) $(CFLAGS) $(NDHC_INC) -c -o $(OBJ_DIR)/src/$@ $(BUILD_DIR)/cfg.c $(CC) $(CFLAGS) $(NDHC_INC) -c -o $(OBJ_DIR)/src/$@ $(BUILD_DIR)/cfg.c
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) -c -o $(OBJ_DIR)/$@ $< $(CC) $(CFLAGS) $(NDHC_INC) -c -o $(OBJ_DIR)/$@ $<
ndhc: $(NCM_OBJS) $(NDHC_OBJS) ifchd-parse.o cfg.o ndhc: $(NCM_OBJS) $(NDHC_OBJS) ifchd-parse.o cfg.o
$(CC) $(CFLAGS) -o $(BUILD_DIR)/$@ $(subst src/,$(OBJ_DIR)/src/,$(NDHC_OBJS)) $(BUILD_DIR)/objs/src/ifchd-parse.o $(BUILD_DIR)/objs/src/cfg.o $(LINK_LIBS) $(CC) $(CFLAGS) -o $(BUILD_DIR)/$@ $(subst src/,$(OBJ_DIR)/src/,$(NDHC_OBJS)) $(subst src/lib/,$(OBJ_DIR)/src/lib/,$(NCM_OBJS)) $(BUILD_DIR)/objs/src/ifchd-parse.o $(BUILD_DIR)/objs/src/cfg.o $(LINK_LIBS)
.PHONY: all clean .PHONY: all clean