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" ; \
302 MAJRELEASE=`echo $$OSRELEASE | sed 's/\..*//'` ; \
303 if [ $$MAJRELEASE -lt 3 ]; then \
304 PLATFORM="freebsd2" ; \
306 PLATFORM="freebsd3" ; \
310 PLATFORM="nextstep" \
318 *) echo "unknown platform ($$OS $$OSVERSION $$OSRELEASE)..."; \
319 echo "see the file build/PORTS for more information."; \
327 for dir in $$PATH; do \
328 if [ -f $$dir/gcc ]; then \
334 $(LN) ./build/platforms/$$PLATFORM-$$CC/Make-platform .make-platform; \
336 echo "** Set platform to $$PLATFORM with compiler $$CC..."; \
339 Make-common: Make-common.dist
340 @if [ -f Make-common ]; then \
341 echo "Make-common.dist newer than Make-common, check for new options" ;\
342 echo "or touch Make-common to ignore."; \
345 echo "Copy Make-common.dist or Make-common.gmake to Make-common"; \
346 echo " Edit as needed before making!" ; \
349 # rule to build Makefiles by concatenating Make-template file in each
350 # subdirectory with global Make-common, .make-platform, and
351 # build/Make-append files
353 .makefiles: Make-common .make-platform build/Make-append
354 @echo "making Makefiles..."; \
355 HDRFILE=/tmp/Makehdr.$$$$; \
356 DEFSFILE=/tmp/Makedefs.$$$$; \
357 $(CAT) build/Make-append ./.make-platform ./Make-common > $$DEFSFILE; \
358 echo "# --------------------------------------------------------" > $$HDRFILE; \
359 echo "# This file was automatically generated. Do not edit it." >> $$HDRFILE; \
360 echo "# Instead, edit the Make-common file (located in the root" >> $$HDRFILE; \
361 echo "# (of the LDAP distribution). See the LDAP INSTALL file" >> $$HDRFILE; \
362 echo "# for more information." >> $$HDRFILE; \
363 echo "# --------------------------------------------------------" >> $$HDRFILE; \
364 echo "#" >> $$HDRFILE; \
365 for i in `$(FIND) . -type d -print`; do \
366 if [ -f $$i/Make-template ]; then \
367 echo " creating $$i/Makefile"; \
368 $(RM) $$i/Makefile; \
369 $(CAT) $$HDRFILE $$i/Make-template $$DEFSFILE > $$i/Makefile; \
374 $(RM) $$HDRFILE $$DEFSFILE
377 # rule to always build makefiles
381 $(MAKE) $(MFLAGS) .makefiles
382 @echo "Please \"make depend\" before building."
385 # rule to create any tools we need to build everything else
388 @echo "making buildtools"
389 @echo " cd build; $(MAKE) $(MFLAGS)"
390 @( cd build; $(MAKE) $(MFLAGS) )
393 # rule to make a shadow (linked) build area
396 @if [ -f /usr/bin/swconfig ]; then \
397 UNAME=./build/uname.sh; \
398 elif [ -f /bin/uname ]; then \
400 elif [ -f /usr/bin/uname ]; then \
401 UNAME=/usr/bin/uname; \
403 UNAME=./build/uname.sh; \
405 if [ ! -z "$(DEST)" ]; then \
408 DEST=./obj-`$$UNAME -s`-`$$UNAME -r` ; \
410 echo "making links in $$DEST..."; \
411 LINKLIST=/tmp/ldaplinklist.$$$$; \
414 cd $$DEST; $(LN) $(LDAPSRC) .src; \
415 $(LN) .src/Makefile . ; \
416 $(CP) .src/Make-common . ; $(CHMOD) 644 ./Make-common; \
417 for d in build $(SRCDIRS) $(TESTDIR); do \
418 ( $(MKDIR) $$d; cd $$d; $(LN) ../.src/$$d .src; \
419 $(LN) .src/Make-template . ; \
420 $(MAKE) $(MFLAGS) MKDIR="$(MKDIR)" LN="$(LN)" \
421 -f Make-template links ) ; \
423 echo ""; echo "Now type:"; echo " cd $$DEST"; echo "and make there"