Teach the Makefile how to handle Ragel, too.

This commit is contained in:
Nicholas J. Kain 2013-05-08 09:08:47 -04:00
parent 6654ad1300
commit bf3de7f310

View File

@ -18,7 +18,7 @@ AR = ar
RANLIB = ranlib
CFLAGS = -O2 -s -std=gnu99 -pedantic -Wall -D_GNU_SOURCE -DHAVE_CLEARENV -DLINUX
all: makedir ncmlib.a ifchd ndhc
all: makedir ifchd-parse.o ncmlib.a ifchd ndhc
clean:
rm -Rf $(BUILD_DIR)
@ -26,6 +26,10 @@ clean:
makedir:
mkdir -p $(BUILD_DIR) $(OBJ_DIR)/ndhc $(OBJ_DIR)/ifchd $(OBJ_DIR)/ncmlib
ifchd-parse.o:
ragel -G2 -o $(BUILD_DIR)/ifchd-parse.c ifchd/ifchd-parse.rl
$(CC) $(CFLAGS) $(IFCH_INC) $(NCM_INC) -c -o $(OBJ_DIR)/ifchd/$@ $(BUILD_DIR)/ifchd-parse.c
%.o: %.c
$(CC) $(CFLAGS) $(IFCH_INC) $(NCM_INC) -c -o $(OBJ_DIR)/$@ $<
@ -33,8 +37,8 @@ ncmlib.a: $(NCM_OBJS)
$(AR) rc $(BUILD_DIR)/$@ $(subst ncmlib/,$(OBJ_DIR)/ncmlib/,$(NCM_OBJS))
$(RANLIB) $(BUILD_DIR)/$@
ifchd: $(IFCHD_OBJS)
$(CC) $(CFLAGS) $(NCM_INC) -o $(BUILD_DIR)/$@ $(subst ifchd/,$(OBJ_DIR)/ifchd/,$(IFCHD_OBJS)) $(BUILD_DIR)/ncmlib.a -lcap
ifchd: $(IFCHD_OBJS) ifchd-parse.o
$(CC) $(CFLAGS) $(NCM_INC) -o $(BUILD_DIR)/$@ $(subst ifchd/,$(OBJ_DIR)/ifchd/,$(IFCHD_OBJS)) $(BUILD_DIR)/objs/ifchd/ifchd-parse.o $(BUILD_DIR)/ncmlib.a -lcap
ndhc: $(NDHC_OBJS)
$(CC) $(CFLAGS) $(IFCH_INC) $(NCM_INC) -o $(BUILD_DIR)/$@ $(subst ndhc/,$(OBJ_DIR)/ndhc/,$(NDHC_OBJS)) $(BUILD_DIR)/ncmlib.a -lcap -lrt