-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
54 lines (46 loc) · 1.44 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
GCC = /usr/bin/gcc
LIBS = -l pthread
DEBUG = f
BASICOPTIONS = -Wall -O2 -s
ifeq ($(DEBUG),t)
OPTIONS = $(BASICOPTIONS) -g
else
OPTIONS = $(BASICOPTIONS)
endif
INCLUDE =
CFLAGS = $(INCLUDE) $(OPTIONS)
OBJS_TUN = ustun.o inout.o common.o filter.o clist.o state.o logger.o ctrl.o
OBJS_TABLES = us6tables.o common.o filter.o commands.o clist.o state.o logger.o
OBJS_CTRL = usctrl.o common.o filter.o logger.o state.o clist.o ctrl.o
EXE = ustun us6tables usctrl
# All targets
all: $(EXE)
@if [ "$(DEBUG)" = "t" ]; then echo 'IMPORTANT: COMPILED WITH DEBUGINFO!!'; fi
ustun: $(OBJS_TUN) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
$(GCC) $(LIB) -o ustun $(OBJS_TUN) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
us6tables: $(OBJS_TABLES) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
$(GCC) $(LIB) -o us6tables $(OBJS_TABLES) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
usctrl: $(OBJS_CTRL) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
$(GCC) $(LIB) -o usctrl $(OBJS_CTRL) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
%.o: %.c incs/%.h incs/common.h
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
$(GCC) -DSOURCE_$(basename $@) -c $(CFLAGS) -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
clean:
rm *.o ustun us6tables usctrl
install:
/usr/bin/install -t /usr/local/sbin/ -v $(EXE)