forked from sem-hub/dhcprelya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (49 loc) · 1.82 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
55
56
57
58
59
60
61
62
PROGNAME= dhcprelya
OBJS= dhcprelya.o utils.o net_utils.o ip_checksum.o log_plugin.o \
option82_plugin.o
HEADER= dhcprelya.h
LIBS= -L/usr/local/lib -lpcap -lutil -lthr
CFLAGS+= -Wall -fPIC
LOG_PLUGIN_OBJS= utils.o log_plugin.o
OPTION82_PLUGIN_OBJS= utils.o option82_plugin.o ip_checksum.o
.if defined(DEBUG)
DEBUG_FLAGS= -g
.else
STRIP_FLAG= -s
.endif
LOG_PLUGIN= log_plugin
RADIUS_PLUGIN= radius_plugin
OPTION82_PLUGIN= option82_plugin
.if defined(WITH_RADIUS_PLUGIN)
LIBS+= -lradius
RADIUS_PLUGIN_OBJS= utils.o net_utils.o radius_plugin.o
OBJS+= radius_plugin.o
CFLAGS+= -rdynamic
all: ${PROGNAME} ${PROGNAME}_${RADIUS_PLUGIN}.so ${PROGNAME}_${LOG_PLUGIN}.so \
${PROGNAME}_${OPTION82_PLUGIN}.so
.else
all: ${PROGNAME} ${PROGNAME}_${LOG_PLUGIN}.so ${PROGNAME}_${OPTION82_PLUGIN}.so
.endif
${PROGNAME}: ${OBJS}
${CC} ${DEBUG_FLAGS} ${CFLAGS} ${OBJS} ${LIBS} -o ${.TARGET}
${PROGNAME}_${RADIUS_PLUGIN}.so: ${OBJS}
${CC} ${DEBUG_FLAGS} -shared ${RADIUS_PLUGIN_OBJS} -o ${.TARGET}
${PROGNAME}_${LOG_PLUGIN}.so: ${OBJS}
${CC} ${DEBUG_FLAGS} -shared ${LOG_PLUGIN_OBJS} -o ${.TARGET}
${PROGNAME}_${OPTION82_PLUGIN}.so: ${OBJS}
${CC} ${DEBUG_FLAGS} -shared ${OPTION82_PLUGIN_OBJS} -o ${.TARGET}
.c.o: ${HEADER}
${CC} ${CPPFLAGS} ${DEBUG_FLAGS} ${CFLAGS} -c ${.IMPSRC}
clean:
rm -f ${PROGNAME} *.so *.o *.core
install: ${PROGNAME}
install ${STRIP_FLAG} -m 555 ${PROGNAME} /usr/local/sbin/
install ${STRIP_FLAG} -m 555 ${PROGNAME}_${LOG_PLUGIN}.so /usr/local/lib/
install ${STRIP_FLAG} -m 555 ${PROGNAME}_${OPTION82_PLUGIN}.so /usr/local/lib/
.if defined(WITH_RADIUS_PLUGIN)
install ${STRIP_FLAG} -m 555 ${PROGNAME}_${RADIUS_PLUGIN}.so /usr/local/lib/
.endif
install-rc:
install -m 555 ${PROGNAME}.sh /usr/local/etc/rc.d/${PROGNAME}
deinstall:
rm -f /usr/local/sbin/${PROGNAME} /usr/local/lib/${PROGNAME}_* /usr/local/etc/rc.d/${PROGNAME}