1 # You will usually NOT need to edit this file at all: instead, edit the
2 # Make-common file. See the LDAP INSTALL file for more information.
3 #-----------------------------------------------------------------------------
4 # Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
7 # Redistribution and use in source and binary forms are permitted only
8 # as authorized by the OpenLDAP Public License. A copy of this
9 # license is available at http://www.OpenLDAP.org/license.html or
10 # in file LICENSE in the top-level directory of the distribution.
12 # This work is derived from the University of Michigan LDAP v3.3
13 # distribution. Information concerning is available at
14 # http://www.umich.edu/~dirsvcs/ldap/ldap.html.
16 # This work also contains materials derived from public sources.
17 #-----------------------------------------------------------------------------
18 # Copyright (c) 1994 Regents of the University of Michigan.
19 # All rights reserved.
21 # Redistribution and use in source and binary forms are permitted
22 # provided that this notice is preserved and that due credit is given
23 # to the University of Michigan at Ann Arbor. The name of the University
24 # may not be used to endorse or promote products derived from this
25 # software without specific prior written permission. This software
26 # is provided ``as is'' without express or implied warranty.
27 #-----------------------------------------------------------------------------
28 # LDAP lightweight X.500 Directory access top level makefile
30 ############################################################################
32 # Usually you will not need to edit anything in this file #
34 ############################################################################
36 # Note that these definitions of standard Unix utilities are only used
37 # in this Makefile. The Make-common (and .make-platform) files have a
38 # similar set of definitions that are used in all the other LDAP Makefiles.
60 SRCDIRS= include libraries clients servers doc
64 # LDAPSRC is used by the links rule
70 # rules to make the software
75 @for i in $(SRCDIRS); do \
76 echo; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
77 ( cd $$i; $(MAKE) $(MFLAGS) all ); \
81 @echo "making libraries only"
82 @echo " cd include; $(MAKE) $(MFLAGS) all"; \
83 cd include; $(MAKE) $(MFLAGS) all
84 @echo " cd libraries; $(MAKE) $(MFLAGS) all"; \
85 cd libraries; $(MAKE) $(MFLAGS) all
89 # rules to install the software
93 @for i in $(SRCDIRS); do \
94 echo; echo "cd $$i; $(MAKE) $(MFLAGS) install"; \
95 ( cd $$i; $(MAKE) $(MFLAGS) install ); \
99 @echo "cd libraries; $(MAKE) $(MFLAGS) install"
100 @( cd libraries; $(MAKE) $(MFLAGS) install )
104 # rules to test the LDAP software
107 @echo " cd $(TESTDIR); $(MAKE) $(MFLAGS) all"; \
108 ( cd $(TESTDIR); $(MAKE) $(MFLAGS) all );
111 # rules to make clean
115 @if [ -f .makefiles ]; then \
116 for i in $(SRCDIRS) $(TESTDIR); do \
117 echo; echo "cd $$i; $(MAKE) $(MFLAGS) clean"; \
118 ( cd $$i; $(MAKE) $(MFLAGS) clean ); \
121 ( for d in ./obj-*; do \
122 if [ $$d != "./obj-*" ]; then \
123 ( echo "making clean in $$d..."; \
124 cd $$d; $(MAKE) $(MFLAGS) clean; ) \
131 @echo; echo "cd build; $(MAKE) $(MFLAGS) -f Make-template veryclean"; \
132 ( cd build; $(MAKE) $(MFLAGS) -f Make-template veryclean ); \
133 if [ -f .makefiles ]; then \
134 for i in $(SRCDIRS) $(TESTDIR); do \
135 echo; echo "cd $$i; $(MAKE) $(MFLAGS) veryclean"; \
136 ( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
138 echo "finding and removing Makefiles..."; \
139 for i in `$(FIND) . -type d -print`; do \
140 if [ -f $$i/Make-template ]; then \
141 echo "removing file $$i/Makefile"; \
142 $(RM) $$i/Makefile; \
145 echo "removing file .makefiles"; \
148 ( for d in ./obj-*; do \
149 if [ $$d != "./obj-*" ]; then \
150 echo "removing $$d..."; $(RM) -r $$d; \
155 if [ -f .make-platform ]; then \
156 echo "removing link .make-platform"; \
157 $(RM) .make-platform; \
164 # rules to make depend
168 @echo "making depend everywhere"; \
169 echo " cd include; $(MAKE) $(MFLAGS) all"; \
170 ( cd include; $(MAKE) $(MFLAGS) all ); \
171 for i in $(SRCDIRS); do \
172 echo; echo "cd $$i; $(MAKE) $(MFLAGS) depend"; \
173 ( cd $$i; $(MAKE) $(MFLAGS) depend ); \
175 @echo " "; echo Remember to \"make depend\" after each \"make makefiles\"
178 # rules to check out and in Make-template files
181 @echo "checking out Make-template files..."; \
182 for mkfile in `$(FIND) . -name Make-template -type f -print`; do \
187 @echo "enter a one-word log message:"; \
189 echo "checking in Make-template files..."; \
190 for mkfile in `$(FIND) . -name Make-template -type f -print`; do \
191 $(CI) -m$$logmsg -u $$mkfile; \
195 lib-depend: makeconfig
196 @echo "cd libraries; $(MAKE) $(MFLAGS) depend"
197 @( cd libraries; $(MAKE) $(MFLAGS) depend )"
200 # rules to cut a new ldap distribution
202 distribution: makeconfig checkin tar
205 @-VERSION=V`cat ./build/version | $(SED) -e 's/\.//'` ; \
206 echo "Checking in version $$VERSION"; \
207 for i in `$(FIND) . -name \*,v -print | \
208 $(SED) -e 's%RCS/%%' -e 's%,v%%'`; \
210 ci -m"pre-version $$VERSION check-in" -u $$i; \
211 rcs -N$$VERSION: $$i ) \
215 # $(RM) ./Make-common; \
216 # $(CP) ./Make-common.dist ./Make-common; \
217 # $(CHMOD) 644 ./Make-common; \
218 # $(RM) ./include/ldapconfig.h.edit; \
219 # $(CP) ./include/ldapconfig.h.dist ./include/ldapconfig.h.edit; \
220 # $(CHMOD) 644 ./include/ldapconfig.h.edit;
222 BASE=`$(BASENAME) $$PWD`; XFILE=/tmp/ldap-x.$$$$; \
223 ( cd .. ; $(CAT) $$BASE/exclude >$$XFILE; \
224 $(FIND) $$BASE -name RCS -print >> $$XFILE ; \
225 $(FIND) $$BASE -name CVS -print >> $$XFILE ; \
226 $(FIND) $$BASE -name obj-\* -print >> $$XFILE ; \
227 $(FIND) $$BASE -name tags -print >> $$XFILE ; \
228 $(TAR) cvfX ./$$BASE.tar $$XFILE $$BASE; \
231 echo "compressing ../$$BASE.tar..."; \
232 $(COMPRESS) ../$$BASE.tar
235 # rule to force check for change of platform
238 @if [ -f .make-platform ]; then \
239 echo "removing old link .make-platform"; \
240 $(RM) .make-platform; \
242 $(MAKE) $(MFLAGS) .make-platform
245 makeconfig: .makefiles buildtools
248 @if [ -f /usr/bin/swconfig ]; then \
249 UNAME=./build/uname.sh; \
250 elif [ -f /bin/uname ]; then \
252 elif [ -f /usr/bin/uname ]; then \
253 UNAME=/usr/bin/uname; \
255 UNAME=./build/uname.sh; \
257 if [ -z "$$UNAME" ]; then \
258 echo "unknown platform (no $$UNAME or /usr/bin/uname)"; \
259 echo "see the file build/PORTS for more information."; \
262 OS=`$$UNAME -s` ; OSRELEASE=`$$UNAME -r` ; \
263 OSVERSION=`$$UNAME -v` ; \
266 if [ $$OSRELEASE -gt "5" -o $$OSRELEASE -lt "4" ]; then \
267 echo "SunOS release $$OSRELEASE unknown..."; exit 1; \
269 if [ $$OSRELEASE -ge "5" ]; then \
270 MINORVER=`echo $$OSRELEASE|sed 's/^.*\.//'` ; \
271 if [ $$MINORVER -ge "6" ]; then \
272 PLATFORM="sunos56" ; \
299 MAJRELEASE=`echo $$OSRELEASE | sed 's/\..*//'` ; \
300 if [ $$MAJRELEASE -lt 3 ]; then \
301 PLATFORM="freebsd2" ; \
303 PLATFORM="freebsd3" ; \
307 PLATFORM="nextstep" \
315 *) echo "unknown platform ($$OS $$OSVERSION $$OSRELEASE)..."; \
316 echo "see the file build/PORTS for more information."; \
324 for dir in $$PATH; do \
325 if [ -f $$dir/gcc ]; then \
331 $(LN) ./build/platforms/$$PLATFORM-$$CC/Make-platform .make-platform; \
333 echo "** Set platform to $$PLATFORM with compiler $$CC..."; \
336 Make-common: Make-common.dist
337 @if [ -f Make-common ]; then \
338 echo "Make-common.dist newer than Make-common, check for new options" ;\
339 echo "or touch Make-common to ignore."; \
342 cp Make-common.dist Make-common; \
343 echo "Make-common installed from distribution." ; \
344 echo " Edit as needed before making!" ; \
347 # rule to build Makefiles by concatenating Make-template file in each
348 # subdirectory with global Make-common, .make-platform, and
349 # build/Make-append files
351 .makefiles: Make-common .make-platform build/Make-append
352 @echo "making Makefiles..."; \
353 HDRFILE=/tmp/Makehdr.$$$$; \
354 DEFSFILE=/tmp/Makedefs.$$$$; \
355 $(CAT) build/Make-append ./.make-platform ./Make-common > $$DEFSFILE; \
356 echo "# --------------------------------------------------------" > $$HDRFILE; \
357 echo "# This file was automatically generated. Do not edit it." >> $$HDRFILE; \
358 echo "# Instead, edit the Make-common file (located in the root" >> $$HDRFILE; \
359 echo "# (of the LDAP distribution). See the LDAP INSTALL file" >> $$HDRFILE; \
360 echo "# for more information." >> $$HDRFILE; \
361 echo "# --------------------------------------------------------" >> $$HDRFILE; \
362 echo "#" >> $$HDRFILE; \
363 for i in `$(FIND) . -type d -print`; do \
364 if [ -f $$i/Make-template ]; then \
365 echo " creating $$i/Makefile"; \
366 $(RM) $$i/Makefile; \
367 $(CAT) $$HDRFILE $$i/Make-template $$DEFSFILE > $$i/Makefile; \
372 $(RM) $$HDRFILE $$DEFSFILE
375 # rule to always build makefiles
379 $(MAKE) $(MFLAGS) .makefiles
380 @echo "Please \"make depend\" before building."
383 # rule to create any tools we need to build everything else
386 @echo "making buildtools"
387 @echo " cd build; $(MAKE) $(MFLAGS)"
388 @( cd build; $(MAKE) $(MFLAGS) )
391 # rule to make a shadow (linked) build area
394 @if [ -f /usr/bin/swconfig ]; then \
395 UNAME=./build/uname.sh; \
396 elif [ -f /bin/uname ]; then \
398 elif [ -f /usr/bin/uname ]; then \
399 UNAME=/usr/bin/uname; \
401 UNAME=./build/uname.sh; \
403 if [ ! -z "$(DEST)" ]; then \
406 DEST=./obj-`$$UNAME -s`-`$$UNAME -r` ; \
408 echo "making links in $$DEST..."; \
409 LINKLIST=/tmp/ldaplinklist.$$$$; \
412 cd $$DEST; $(LN) $(LDAPSRC) .src; \
413 $(LN) .src/Makefile . ; \
414 $(CP) .src/Make-common . ; $(CHMOD) 644 ./Make-common; \
415 for d in build $(SRCDIRS) $(TESTDIR); do \
416 ( $(MKDIR) $$d; cd $$d; $(LN) ../.src/$$d .src; \
417 $(LN) .src/Make-template . ; \
418 $(MAKE) $(MFLAGS) MKDIR="$(MKDIR)" LN="$(LN)" \
419 -f Make-template links ) ; \
421 echo ""; echo "Now type:"; echo " cd $$DEST"; echo "and make there"