Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

gdp / gdp / Makefile @ master

History | View | Annotate | Download (6.64 KB)

1 055d3009 Eric Allman
#
2
#  ----- BEGIN LICENSE BLOCK -----
3
#	GDP: Global Data Plane Support Library
4
#	From the Ubiquitous Swarm Lab, 490 Cory Hall, U.C. Berkeley.
5
#
6 c87dd166 Eric Allman
#	Copyright (c) 2015-2019, Regents of the University of California.
7 6bd5476b Eric Allman
#	All rights reserved.
8 055d3009 Eric Allman
#
9 6bd5476b Eric Allman
#	Permission is hereby granted, without written agreement and without
10
#	license or royalty fees, to use, copy, modify, and distribute this
11
#	software and its documentation for any purpose, provided that the above
12
#	copyright notice and the following two paragraphs appear in all copies
13
#	of this software.
14 055d3009 Eric Allman
#
15 6bd5476b Eric Allman
#	IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
16
#	SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST
17
#	PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
18
#	EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 055d3009 Eric Allman
#
20 6bd5476b Eric Allman
#	REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
21 055d3009 Eric Allman
#	LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 6bd5476b Eric Allman
#	FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION,
23
#	IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO
24
#	OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
25
#	OR MODIFICATIONS.
26 055d3009 Eric Allman
#  ----- END LICENSE BLOCK -----
27
#
28
29 ab6157ea Eric Allman
# Version number of library.  All others are derived from here.
30 98a1bdeb Eric Allman
# NOTE: lang/python/gdp/MISC.py has MAJOR.MINOR hard coded; if you change
31
#       either of them, change `gdp_ver` in that file too.  (This is not
32
#       a feature.)
33
# FIXME: This should be in the top level Makefile, not here.
34 2f496278 Eric Allman
GDP_VERSION_MAJOR=	2
35 c3369218 Eric Allman
GDP_VERSION_MINOR=	3
36 7f982ac3 Eric Allman
GDP_VERSION_PATCH=	3
37 3bf6c8bc Eric Allman
38
# These are generally changed on make command line
39 cca3bf6e Eric Allman
DESTDIR=
40 bd34b3a7 Eric Allman
LOCALROOT=	/usr
41 475517e0 Eric Allman
LOCAL1=		/usr/local
42
LOCAL2=		/opt/local
43 2a2ce319 Eric Allman
LOCAL3=		/usr/local/opt/openssl
44 3bf6c8bc Eric Allman
45
# These generally do not need to be changed
46 bd34b3a7 Eric Allman
INSTALLROOT=	${DESTDIR}${LOCALROOT}
47
INCDIR=		${INSTALLROOT}/include
48
LIBDIR=		${INSTALLROOT}/lib
49 596605f2 Eric Allman
BINDIR=		${INSTALLROOT}/bin
50
SBINDIR=	${INSTALLROOT}/sbin
51
MANDIR=		${INSTALLROOT}/share/man
52 4deac29c Eric Allman
ALLDIRS=	${BINDIR} \
53
		${SBINDIR} \
54
		${LIBDIR} \
55 9379c368 Eric Allman
		${INCDIR}/gdp \
56 4deac29c Eric Allman
		${MANDIR}/man7 \
57
		${MANDIR}/man8
58 3bf6c8bc Eric Allman
ADM=		../adm
59
LOCALLIBSDIR=	../libs
60
LIBNAME=	libgdp
61 596605f2 Eric Allman
62
BINALL=
63
64
SBINALL=
65
66
MAN1ALL=
67
68
MAN3ALL=
69
70
MAN5ALL=
71
72
MAN7ALL=	gdp.7 \
73
74 4deac29c Eric Allman
MAN8ALL=
75
76 596605f2 Eric Allman
MANALL=		${MAN1ALL} ${MAN3ALL} ${MAN5ALL} ${MAN7ALL} ${MAN8ALL}
77 47c6ea64 Eric Allman
78 29e6f6d0 Christopher Brooks
OBJS_ZC = \
79
	gdp_zc_client.o \
80
	gdp_zc_server.o
81
82 937851e5 Eric Allman
OBJS_MOST=	\
83 8dd98fb6 Eric Allman
	gdp_api.o \
84 51775f02 Eric Allman
	gdp_buf.o \
85 7a52336b Eric Allman
	gdp_chan.o \
86 80da996e Eric Allman
	gdp_create.o \
87 9a47c6c7 Eric Allman
	gdp_crypto.o \
88 fec93aac Eric Allman
	gdp_datum.o \
89 9509f13b Eric Allman
	gdp_event.o \
90 fec93aac Eric Allman
	gdp_gob_cache.o \
91
	gdp_gob_mgmt.o \
92
	gdp_gob_ops.o \
93 7a52336b Eric Allman
	gdp_main.o \
94 eae1d3ec Eric Allman
	gdp_md.o \
95 d65c01e2 Eric Allman
	gdp_msg.o \
96 48236b26 Eric Allman
	gdp_name.o \
97 549b367d Eric Allman
	gdp_pdu.o \
98 8dd98fb6 Eric Allman
	gdp_proto.o \
99 837e94b0 Eric Allman
	gdp_req.o \
100 0c663d10 Eric Allman
	gdp_stat.o \
101 1440421a Eric Allman
	gdp_subscr.o \
102 71eb3fe4 Eric Allman
	gdp_util.o \
103 d65c01e2 Eric Allman
	gdp.pb-c.o \
104 29e6f6d0 Christopher Brooks
	$(OBJS_ZC)
105 47c6ea64 Eric Allman
106 937851e5 Eric Allman
OBJS=	\
107
	${OBJS_MOST} \
108
	gdp_version.o
109
110 e18fea5e Eric Allman
PUBHFILES=	\
111 0c663d10 Eric Allman
	gdp.h \
112 7caa7644 Eric Allman
	gdp_buf.h \
113
	gdp_stat.h \
114
	gdp_version.h \
115 728cb9ee Nicholas Sun
	gdp_zc_client.h \
116
	gdp_zc_server.h \
117 e18fea5e Eric Allman
118
PRIVHFILES=	\
119 5a73c6ad Eric Allman
	gdp_chan.h \
120 9509f13b Eric Allman
	gdp_event.h \
121 0e2c49f6 Eric Allman
	gdp_hongd.h \
122 eae1d3ec Eric Allman
	gdp_md.h \
123 549b367d Eric Allman
	gdp_pdu.h \
124 cd2ef2a6 Eric Allman
	gdp_priv.h \
125 d65c01e2 Eric Allman
	gdp.pb-c.h \
126 0c663d10 Eric Allman
127 e18fea5e Eric Allman
HFILES=		${PUBHFILES} ${PRIVHFILES}
128
129 ab6157ea Eric Allman
GDPLIBVER=	${GDP_VERSION_MAJOR}.${GDP_VERSION_MINOR}
130 e18fea5e Eric Allman
INCALL=		${PUBHFILES}
131
LIBALL=		libgdp.a libgdp.so.${GDPLIBVER}
132 596605f2 Eric Allman
# files that should be removed on "make clean"
133 ab6157ea Eric Allman
CLEANALL=	${LIBALL} ${BINALL} ${SBINALL} gdp_version.h
134 596605f2 Eric Allman
# files that should be publicly installed
135 3bf6c8bc Eric Allman
PUBALL=		${SCRIPTS} ${MANALL} ${INCALL} ${LIBALL}
136 596605f2 Eric Allman
# "make all" targets (may be overlap)
137
ALL=		${CLEANALL} ${PUBALL}
138 47c6ea64 Eric Allman
139 763b221d Eric Allman
SANITIZE=
140
#SANITIZE+=	-fsanitize=address
141
#SANITIZE+=	-fsanitize=thread
142
#SANITIZE+=	-fsanitize=memory
143
#SANITIZE+=	-fsanitize=undefined
144
145 acc40055 Eric Allman
INCROOT=	..
146 475517e0 Eric Allman
INCSEARCH=	${INCLOCAL} \
147
		-I${INCROOT} \
148 e0451f24 Eric Allman
		`mysql_config --include` \
149 475517e0 Eric Allman
		-I${LOCAL1}/include \
150 2a2ce319 Eric Allman
		-I${LOCAL2}/include \
151
		-I${LOCAL3}/include
152 acc40055 Eric Allman
LIBROOT=	${INCROOT}
153
LIBEVENT2=	-levent -levent_pthreads
154 d65c01e2 Eric Allman
LIBCRYPTO=	-lcrypto
155
LIBPROTO_C=	-lprotobuf-c
156 728cb9ee Nicholas Sun
LIBAVAHI=	-lavahi-client -lavahi-common
157 e0451f24 Eric Allman
LIBMYSQL=	`mysql_config --libs`
158 e21cfe68 Eric Allman
LIBADD=		`sh ../adm/add-libs.sh libgdp`
159 acc40055 Eric Allman
INCEP=		-I${INCROOT}
160 3a80c46d Eric Allman
LIBEP=		-lep
161 475517e0 Eric Allman
INCS=		${INCSEARCH} ${INCEP} ${INCEVENT2} ${INCAVAHI}
162
LIBSEARCH=	${LIBLOCAL} \
163 3a80c46d Eric Allman
		-L${LIBROOT}/ep \
164
		-L${LOCAL1}/lib \
165 2a2ce319 Eric Allman
		-L${LOCAL2}/lib \
166
		-L${LOCAL3}/lib
167 762e7ecf Eric Allman
LDFLAGS+= 	${LIBSEARCH} ${SANITIZE}
168 d5ef0254 Eric Allman
LDLIBS=		${LIBEP} \
169
		${LIBEVENT2} \
170
		${LIBCRYPTO} \
171 d65c01e2 Eric Allman
		${LIBPROTO_C} \
172 59c6c7e0 Eric Allman
		${LIBAVAHI} \
173 e21cfe68 Eric Allman
		${LIBMYSQL} \
174 59c6c7e0 Eric Allman
		${LIBADD}
175 1b663276 Eric Allman
CC=		cc
176 47c6ea64 Eric Allman
PG=
177 696860c5 Eric Allman
WALL=		-Wall
178 1b663276 Eric Allman
G=		-g
179
O=		-O
180 2443e497 Eric Allman
STD=
181 763b221d Eric Allman
COPTS=		${PG} ${WALL} $G $O ${STD} ${SANITIZE}
182 f5c1552e Eric Allman
CFLAGS+=	${COPTS} ${INCS} -fPIC
183 acc40055 Eric Allman
184 c0283029 Eric Allman
LN=		ln
185 927f30ba Eric Allman
MV=		mv
186 e18fea5e Eric Allman
CP=		cp
187 927f30ba Eric Allman
RM=		rm
188 e18fea5e Eric Allman
MKDIR=		mkdir -p
189 73ea59bf Eric Allman
RANLIB=		ranlib
190 d65c01e2 Eric Allman
PROTOC_C=	protoc-c
191 765973fa Eric Allman
SHARED=		-shared ${CRYPTOLFLAGS}
192
#SHARED=		-shared ${CRYPTOLFLAGS} -Wl,-soname,$@
193 edf46949 Eric Allman
INSTALLFLAGS=
194
INSTALL=	install ${INSTALLFLAGS}
195 47c6ea64 Eric Allman
196
all: ${ALL}
197
198 29e6f6d0 Christopher Brooks
# Build without avahi, the zero-conf facility that
199
# can be tricky to compile under Mac OS X.
200
all_noavahi:
201
	${MAKE}	STD=-DGDP_OSCF_USE_ZEROCONF=0 LIBAVAHI= OBJS_ZC= all
202
203 5354ded8 Eric Allman
${LIBNAME}.a: ${OBJS}
204 47c6ea64 Eric Allman
	${AR} -r $@ ${OBJS}
205
	${RANLIB} $@
206 5354ded8 Eric Allman
	${RM} -f ${LOCALLIBSDIR}/$@
207 c9ba48c9 Eric Allman
	${CP} $@ ${LOCALLIBSDIR}
208 47c6ea64 Eric Allman
209 5354ded8 Eric Allman
${LIBNAME}.so.${GDPLIBVER}: ${OBJS}
210 d5ef0254 Eric Allman
	${CC} ${SHARED} -o $@ ${LDFLAGS} ${OBJS} ${LDLIBS}
211 ab6157ea Eric Allman
	${RM} -f ${LOCALLIBSDIR}/$@
212 c9ba48c9 Eric Allman
	${CP} $@ ${LOCALLIBSDIR}
213 8ce56239 Eric Allman
	sh ${LOCALLIBSDIR}/makelinks.sh gdp ${GDP_VERSION_MAJOR} ${GDP_VERSION_MINOR} ${LOCALLIBSDIR}
214 ce8f8347 Nitesh Mor
215 0c663d10 Eric Allman
${OBJS}: ${HFILES}
216
217 ab6157ea Eric Allman
218 d65c01e2 Eric Allman
gdp.pb-c.c gdp.pb-c.h: gdp.proto
219
	${PROTOC_C} --c_out=. gdp.proto
220
221 762e7ecf Eric Allman
gdp_version.o: gdp_version.c ${OBJS_MOST} Makefile gdp_version.h
222 6981f823 Eric Allman
	${CC} ${CFLAGS} \
223
		-D_VERSION_INFO_="\"`sh ../adm/get-version-info.sh`\"" \
224
		-c gdp_version.c
225 a8d1cfe0 Eric Allman
226 ac015a81 Eric Allman
gdp_version.h ../adm/gdp-version.sh: gdp_version.template gdp_version.sh Makefile
227 ab6157ea Eric Allman
	sh gdp_version.sh ${GDP_VERSION_MAJOR} ${GDP_VERSION_MINOR} ${GDP_VERSION_PATCH}
228
229 762e7ecf Eric Allman
#../git-version.txt:
230
#	../adm/get-version-info.sh > /dev/null
231 2942b40f Eric Allman
232 3bf6c8bc Eric Allman
#
233
#  Administrative stuff
234
#
235
236
# cleanup
237 47c6ea64 Eric Allman
clean:
238 596605f2 Eric Allman
	-rm -f ${CLEANALL} *.o *.core
239
240 3bf6c8bc Eric Allman
# system installation
241 c9ba48c9 Eric Allman
install-lib: ${LIBDIR} ${LIBALL}
242
	test -z "${LIBALL}"  || ${CP} ${LIBALL}  ${LIBDIR}
243
	sh ${LOCALLIBSDIR}/makelinks.sh gdp ${GDP_VERSION_MAJOR} ${GDP_VERSION_MINOR} ${LIBDIR}
244
245 47d985b0 Eric Allman
install-include: ${INCDIR}/gdp ${INCALL}
246 c9ba48c9 Eric Allman
	test -z "${INCALL}"  || ${CP} ${INCALL}  ${INCDIR}/gdp
247
248
install-bin: ${BINDIR} ${SBINDIR}
249 596605f2 Eric Allman
	test -z "${BINALL}"  || ${INSTALL} ${BINALL}  ${BINDIR}
250
	test -z "${SBINALL}" || ${INSTALL} ${SBINALL} ${SBINDIR}
251 c9ba48c9 Eric Allman
252
install-man: ${MANDIR} ${MANALL}
253 9d5d35f7 Eric Allman
	test -z "${MAN1ALL}" || ${CP} ${MAN1ALL} ${MANDIR}/man1
254
	test -z "${MAN3ALL}" || ${CP} ${MAN3ALL} ${MANDIR}/man3
255
	test -z "${MAN7ALL}" || ${CP} ${MAN7ALL} ${MANDIR}/man7
256
	test -z "${MAN8ALL}" || ${CP} ${MAN8ALL} ${MANDIR}/man8
257 c9ba48c9 Eric Allman
258
install:	install-include install-lib install-bin install-man
259 e18fea5e Eric Allman
260 4deac29c Eric Allman
${ALLDIRS}:
261 e18fea5e Eric Allman
	${MKDIR} $@
262 a8d1cfe0 Eric Allman
263 3bf6c8bc Eric Allman
# local installation (into source tree, needed for Java & Debian package build)
264 ab6157ea Eric Allman
# XXX Why is this needed?  It's done when the libraries are built.
265 3bf6c8bc Eric Allman
install-local:	${LOCALLIBSDIR} ${LIBALL}
266 c9ba48c9 Eric Allman
	${CP} ${LIBALL} ${LOCALLIBSDIR}
267 8ce56239 Eric Allman
	sh ${LOCALLIBSDIR}/makelinks.sh gdp ${GDP_VERSION_MAJOR} ${GDP_VERSION_MINOR} ${LOCALLIBSDIR}
268 3bf6c8bc Eric Allman
269 055d3009 Eric Allman
UPDATE_LICENSE=	${ADM}/update-license.sh
270
271
update-license:
272
	${UPDATE_LICENSE} Makefile *.[ch]
273
274 a8d1cfe0 Eric Allman
FORCE: