2011-07-12 13:39:05 +05:30
|
|
|
# This is a pretty basic makefile. I generally use CMake, so this is mostly
|
|
|
|
# for distros that want to avoid build dependencies. Produced exes will be
|
|
|
|
# at './build/ndhc' and './build/ifchd'.
|
|
|
|
|
|
|
|
NCM_SRCS = $(sort $(wildcard ncmlib/*.c))
|
|
|
|
IFCHD_SRCS = $(sort $(wildcard ifchd/*.c))
|
|
|
|
NDHC_SRCS = $(sort $(wildcard ndhc/*.c))
|
|
|
|
NCM_OBJS = $(NCM_SRCS:.c=.o)
|
|
|
|
IFCHD_OBJS = $(IFCHD_SRCS:.c=.o)
|
|
|
|
NDHC_OBJS = $(NDHC_SRCS:.c=.o)
|
|
|
|
NCM_INC = -I./ncmlib
|
2011-07-25 11:31:38 +05:30
|
|
|
IFCH_INC = -I./ifchd
|
2011-07-12 13:39:05 +05:30
|
|
|
BUILD_DIR = build
|
2011-07-13 04:15:29 +05:30
|
|
|
OBJ_DIR = $(BUILD_DIR)/objs
|
2011-07-12 13:39:05 +05:30
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
AR = ar
|
|
|
|
RANLIB = ranlib
|
|
|
|
CFLAGS = -O2 -s -std=gnu99 -pedantic -Wall -D_GNU_SOURCE -DHAVE_CLEARENV -DLINUX
|
|
|
|
|
|
|
|
all: makedir ncmlib.a ifchd ndhc
|
|
|
|
|
|
|
|
clean:
|
2011-07-13 04:15:29 +05:30
|
|
|
rm -Rf $(BUILD_DIR)
|
2011-07-12 13:39:05 +05:30
|
|
|
|
|
|
|
makedir:
|
2011-07-13 04:15:29 +05:30
|
|
|
mkdir -p $(BUILD_DIR) $(OBJ_DIR)/ndhc $(OBJ_DIR)/ifchd $(OBJ_DIR)/ncmlib
|
2011-07-12 13:39:05 +05:30
|
|
|
|
|
|
|
%.o: %.c
|
2011-07-31 10:57:59 +05:30
|
|
|
$(CC) $(CFLAGS) $(IFCH_INC) $(NCM_INC) -c -o $(OBJ_DIR)/$@ $<
|
2011-07-12 13:39:05 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
ndhc: $(NDHC_OBJS)
|
2011-07-31 10:57:59 +05:30
|
|
|
$(CC) $(CFLAGS) $(IFCH_INC) $(NCM_INC) -o $(BUILD_DIR)/$@ $(subst ndhc/,$(OBJ_DIR)/ndhc/,$(NDHC_OBJS)) $(BUILD_DIR)/ncmlib.a -lcap -lrt
|
2011-07-12 13:39:05 +05:30
|
|
|
|
|
|
|
.PHONY: all clean
|
|
|
|
|