-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
130 lines (118 loc) · 6.1 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
PREFIX?=/usr/local
CC?=/usr/bin/cc
CBSD_HOME=${PREFIX}/cbsd
STRIP="/usr/bin/strip"
RM="/bin/rm"
CP="/bin/cp"
MAKE="/usr/bin/make"
ENV="/usr/bin/env"
INSTALL="/usr/bin/install"
MKDIR="/bin/mkdir"
SIMPLEXMLOBJECT = lib/simplexml/simplexml.o
SIMPLEXMLHEADER = lib/simplexml/simplexml.h
DUMPCPUTOPOLOGYOBJECT = misc/src/dump_cpu_topology.o
DUMPISCSIDISCOVERYOBJECT = misc/src/dump_iscsi_discovery.o
.SILENT:
all: cbsd dump_cpu_topology dump_iscsi_discovery
clean:
${MAKE} -C bin/cbsdsh clean
${MAKE} -C misc/src/sipcalc clean
${RM} -f bin/cbsdsh/.depend* misc/src/*.o ${SIMPLEXMLOBJECT} ${DUMPCPUTOPOLOGYOBJECT} ${DUMPISCSIDISCOVERYOBJECT}
distclean:
${MAKE} -C bin/cbsdsh clean
${RM} -f bin/cbsdsh/.depend*
${RM} -f misc/chk_arp_byip
${RM} -f misc/cbsdtee
${RM} -f bin/cbsdsftp
${RM} -f bin/cbsdsftp6
${RM} -f bin/cfetch
${RM} -f bin/cbsdssh
${RM} -f bin/cbsdssh6
${RM} -f bin/cbsd
${RM} -f sbin/netmask
${RM} -f misc/sqlcli
${RM} -f misc/pwcrypt
${RM} -f misc/cbsdlogtail
${RM} -f misc/elf_tables
${RM} -f misc/fmagic
${RM} -f misc/conv2human
${RM} -f misc/cbsd_fwatch
${RM} -f misc/popcnttest
${RM} -f misc/cbsd_dot
${RM} -f misc/daemon
${RM} -f misc/resolv
${RM} -f misc/ipv6range
${RM} -f misc/next-vale-port
${RM} -f tools/imghelper
${RM} -f tools/xo
${RM} -f tools/vale-ctl
${RM} -f tools/nic_info
${RM} -f tools/bridge
${RM} -f tools/racct-jail-statsd
${RM} -f tools/racct-bhyve-statsd
${RM} -f tools/racct-hoster-statsd
${RM} -f tools/select_jail
${RM} -f misc/sipcalc
# clean object files
${RM} -f misc/dump_cpu_topology
${RM} -f misc/dump_iscsi_discovery
${RM} -f ${SIMPLEXMLOBJECT}
${RM} -f ${DUMPCPUTOPOLOGYOBJECT}
${RM} -f ${DUMPISCSIDISCOVERYOBJECT}
dump_cpu_topology:
${CC} -g -c -Wall -Ilib/simplexml misc/src/dump_cpu_topology.c -o ${DUMPCPUTOPOLOGYOBJECT}
${CC} -g -c -Wall -Ilib/simplexml lib/simplexml/simplexml.c -o ${SIMPLEXMLOBJECT}
${CC} -g -o misc/dump_cpu_topology ${DUMPCPUTOPOLOGYOBJECT} ${SIMPLEXMLOBJECT}
${STRIP} misc/dump_cpu_topology
dump_iscsi_discovery:
${CC} -g -c -Wall -Ilib/simplexml misc/src/dump_iscsi_discovery.c -o ${DUMPISCSIDISCOVERYOBJECT}
${CC} -g -c -Wall -Ilib/simplexml lib/simplexml/simplexml.c -o ${SIMPLEXMLOBJECT}
${CC} -g -o misc/dump_iscsi_discovery ${DUMPISCSIDISCOVERYOBJECT} ${SIMPLEXMLOBJECT}
${STRIP} misc/dump_iscsi_discovery
pkg-config-check:
@/usr/bin/which -s pkg-config || \
(echo "pkg-config must be present on the system to build CBSD from the source. Please install it first: pkg install pkgconf"; /usr/bin/false)
cbsd: pkg-config-check
${CC} bin/cbsdsftp.c -o bin/cbsdsftp -lssh2 -L/usr/local/lib -I/usr/local/include && ${STRIP} bin/cbsdsftp
${CC} bin/cbsdsftp6.c -o bin/cbsdsftp6 -lssh2 -L/usr/local/lib -I/usr/local/include && ${STRIP} bin/cbsdsftp6
${CC} bin/cbsdssh.c -o bin/cbsdssh -lssh2 -L/usr/local/lib -I/usr/local/include && ${STRIP} bin/cbsdssh
${CC} bin/cbsdssh6.c -o bin/cbsdssh6 -lssh2 -L/usr/local/lib -I/usr/local/include && ${STRIP} bin/cbsdssh6
${CC} bin/cfetch.c -o bin/cfetch -lfetch -L/usr/local/lib -I/usr/local/include && ${STRIP} bin/cfetch
${CC} sbin/netmask.c -o sbin/netmask && ${STRIP} sbin/netmask
${CC} misc/src/sqlcli.c `pkg-config sqlite3 --cflags --libs` -lm -o misc/sqlcli && ${STRIP} misc/sqlcli
${CC} misc/src/cbsdlogtail.c -o misc/cbsdlogtail && ${STRIP} misc/cbsdlogtail
${CC} misc/src/pwcrypt.c -lcrypt -o misc/pwcrypt && ${STRIP} misc/pwcrypt
${CC} misc/src/chk_arp_byip.c -o misc/chk_arp_byip && ${STRIP} misc/chk_arp_byip
${CC} misc/src/cbsdtee.c -o misc/cbsdtee && ${STRIP} misc/cbsdtee
${CC} misc/src/elf_tables.c -I/usr/local/include -I/usr/local/include/libelf -L/usr/local/lib -lelf -o misc/elf_tables && ${STRIP} misc/elf_tables
${CC} misc/src/fmagic.c -lmagic -o misc/fmagic && ${STRIP} misc/fmagic
${CC} misc/src/conv2human.c -I/usr/local/include -I/usr/local/include/libelf -L/usr/local/lib -lelf -o misc/conv2human -lutil && ${STRIP} misc/conv2human
${CC} misc/src/cbsd_fwatch.c -o misc/cbsd_fwatch && ${STRIP} misc/cbsd_fwatch
${CC} misc/src/popcnttest.c -o misc/popcnttest -msse4.2 && ${STRIP} misc/popcnttest > /dev/null 2>&1 || /usr/bin/true
${CC} misc/src/cbsd_dot.c -o misc/cbsd_dot && ${STRIP} misc/cbsd_dot
${CC} misc/src/daemon.c -lutil -o misc/daemon && ${STRIP} misc/daemon
${CC} misc/src/resolv.c -o misc/resolv && ${STRIP} misc/resolv
${CC} misc/src/ipv6range.c -o misc/ipv6range && ${STRIP} misc/ipv6range
${CC} misc/src/next-vale-port.c -o misc/next-vale-port && ${STRIP} misc/next-vale-port
${CC} tools/src/imghelper.c -o tools/imghelper && ${STRIP} tools/imghelper
${CC} tools/src/bridge.c -o tools/bridge && ${STRIP} tools/bridge
${CC} tools/src/vale-ctl.c -o tools/vale-ctl && ${STRIP} tools/vale-ctl
${CC} tools/src/nic_info.c -o tools/nic_info && ${STRIP} tools/nic_info
.if defined(WITH_INFLUX)
EXTRAC=" ../../bin/cbsdsh/contrib/ini.c -lcurl -DWITH_INFLUX"
.endif
${CC} tools/src/racct-jail-statsd.c lib/beanstalk-client/beanstalk.c ${EXTRAC} -lutil -lprocstat -ljail -lsqlite3 -I/usr/local/include -Ilib/beanstalk-client -L/usr/local/lib -o tools/racct-jail-statsd && ${STRIP} tools/racct-jail-statsd
${CC} tools/src/racct-bhyve-statsd.c lib/beanstalk-client/beanstalk.c ${EXTRAC} -lutil -lprocstat -ljail -lsqlite3 -I/usr/local/include -Ilib/beanstalk-client -L/usr/local/lib -o tools/racct-bhyve-statsd && ${STRIP} tools/racct-bhyve-statsd
.if defined(WITH_REDIS)
EXTRAC+=" ../../bin/cbsdsh/cbsdredis.c ../../bin/cbsdsh/contrib/credis.c -DWITH_REDIS"
.endif
${CC} tools/src/racct-hoster-statsd.c lib/beanstalk-client/beanstalk.c ${EXTRAC} -lutil -lprocstat -ljail -lsqlite3 -lpthread -I/usr/local/include -Ilib/beanstalk-client -L/usr/local/lib -o tools/racct-hoster-statsd && ${STRIP} tools/racct-hoster-statsd
${CC} tools/src/select_jail.c -o tools/select_jail && ${STRIP} tools/select_jail
${MAKE} -C bin/cbsdsh && ${STRIP} bin/cbsdsh/cbsd
${MAKE} -C misc/src/sipcalc && ${STRIP} misc/src/sipcalc/sipcalc
${MAKE} -C share/bsdconfig/cbsd
install:
${INSTALL} man/cbsd.8 ${DESTDIR}${PREFIX}/man/man8/cbsd.8
${INSTALL} -o cbsd -g cbsd -m 555 misc/src/sipcalc/sipcalc ${PREFIX}/cbsd/misc/sipcalc
${ENV} BINDIR=${PREFIX}/bin ${MAKE} -C bin/cbsdsh install
${MAKE} -C share/bsdconfig/cbsd install