2 # You will usually NOT need to edit this file at all: instead, edit the
3 # Make-common file. See the LDAP INSTALL file for more information.
5 #-----------------------------------------------------------------------------
6 # Copyright (c) 1994 Regents of the University of Michigan.
9 # Redistribution and use in source and binary forms are permitted
10 # provided that this notice is preserved and that due credit is given
11 # to the University of Michigan at Ann Arbor. The name of the University
12 # may not be used to endorse or promote products derived from this
13 # software without specific prior written permission. This software
14 # is provided ``as is'' without express or implied warranty.
16 # LDAP lightweight X.500 Directory access top level makefile
18 #-----------------------------------------------------------------------------
20 ############################################################################
22 # Usually you will not need to edit anything in this file #
24 ############################################################################
26 # Note that these definitions of standard Unix utilities are only used
27 # in this Makefile. The Make-common (and .make-platform) files have a
28 # similar set of definitions that are used in all the other LDAP Makefiles.
50 SRCDIRS= include libraries clients servers doc
54 # LDAPSRC is used by the links rule
60 # rules to make the software
65 @for i in $(SRCDIRS); do \
66 echo; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
67 ( cd $$i; $(MAKE) $(MFLAGS) all ); \
71 @echo "making libraries only"
72 @echo " cd include; $(MAKE) $(MFLAGS) all"; \
73 cd include; $(MAKE) $(MFLAGS) all
74 @echo " cd libraries; $(MAKE) $(MFLAGS) all"; \
75 cd libraries; $(MAKE) $(MFLAGS) all
79 # rules to install the software
83 @for i in $(SRCDIRS); do \
84 echo; echo "cd $$i; $(MAKE) $(MFLAGS) install"; \
85 ( cd $$i; $(MAKE) $(MFLAGS) install ); \
89 @echo "cd libraries; $(MAKE) $(MFLAGS) install"
90 @( cd libraries; $(MAKE) $(MFLAGS) install )
94 # rules to test the LDAP software
97 @echo " cd $(TESTDIR); $(MAKE) $(MFLAGS) all"; \
98 ( cd $(TESTDIR); $(MAKE) $(MFLAGS) all );
101 # rules to make clean
105 @if [ -f .makefiles ]; then \
106 for i in $(SRCDIRS) $(TESTDIR); do \
107 echo; echo "cd $$i; $(MAKE) $(MFLAGS) clean"; \
108 ( cd $$i; $(MAKE) $(MFLAGS) clean ); \
111 ( for d in ./obj-*; do \
112 if [ $$d != "./obj-*" ]; then \
113 ( echo "making clean in $$d..."; \
114 cd $$d; $(MAKE) $(MFLAGS) clean; ) \
121 @echo; echo "cd build; $(MAKE) $(MFLAGS) -f Make-template veryclean"; \
122 ( cd build; $(MAKE) $(MFLAGS) -f Make-template veryclean ); \
123 if [ -f .makefiles ]; then \
124 for i in $(SRCDIRS) $(TESTDIR); do \
125 echo; echo "cd $$i; $(MAKE) $(MFLAGS) veryclean"; \
126 ( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
128 echo "finding and removing Makefiles..."; \
129 for i in `$(FIND) . -type d -print`; do \
130 if [ -f $$i/Make-template ]; then \
131 echo "removing file $$i/Makefile"; \
132 $(RM) $$i/Makefile; \
135 echo "removing file .makefiles"; \
138 ( for d in ./obj-*; do \
139 if [ $$d != "./obj-*" ]; then \
140 echo "removing $$d..."; $(RM) -r $$d; \
145 if [ -f .make-platform ]; then \
146 echo "removing link .make-platform"; \
147 $(RM) .make-platform; \
154 # rules to make depend
158 @echo "making depend everywhere"; \
159 echo " cd include; $(MAKE) $(MFLAGS) all"; \
160 ( cd include; $(MAKE) $(MFLAGS) all ); \
161 for i in $(SRCDIRS); do \
162 echo; echo "cd $$i; $(MAKE) $(MFLAGS) depend"; \
163 ( cd $$i; $(MAKE) $(MFLAGS) depend ); \
167 # rules to check out and in Make-template files
170 @echo "checking out Make-template files..."; \
171 for mkfile in `$(FIND) . -name Make-template -type f -print`; do \
176 @echo "enter a one-word log message:"; \
178 echo "checking in Make-template files..."; \
179 for mkfile in `$(FIND) . -name Make-template -type f -print`; do \
180 $(CI) -m$$logmsg -u $$mkfile; \
184 lib-depend: makeconfig
185 @echo "cd libraries; $(MAKE) $(MFLAGS) depend"
186 @( cd libraries; $(MAKE) $(MFLAGS) depend )"
189 # rules to cut a new ldap distribution
191 distribution: makeconfig checkin tar
194 @-VERSION=V`cat ./build/version | $(SED) -e 's/\.//'` ; \
195 echo "Checking in version $$VERSION"; \
196 for i in `$(FIND) . -name \*,v -print | \
197 $(SED) -e 's%RCS/%%' -e 's%,v%%'`; \
199 ci -m"pre-version $$VERSION check-in" -u $$i; \
200 rcs -N$$VERSION: $$i ) \
204 # $(RM) ./Make-common; \
205 # $(CP) ./Make-common.dist ./Make-common; \
206 # $(CHMOD) 644 ./Make-common; \
207 # $(RM) ./include/ldapconfig.h.edit; \
208 # $(CP) ./include/ldapconfig.h.dist ./include/ldapconfig.h.edit; \
209 # $(CHMOD) 644 ./include/ldapconfig.h.edit;
211 BASE=`$(BASENAME) $$PWD`; XFILE=/tmp/ldap-x.$$$$; \
212 ( cd .. ; $(CAT) $$BASE/exclude >$$XFILE; \
213 $(FIND) $$BASE -name RCS -print >> $$XFILE ; \
214 $(FIND) $$BASE -name CVS -print >> $$XFILE ; \
215 $(FIND) $$BASE -name obj-\* -print >> $$XFILE ; \
216 $(FIND) $$BASE -name tags -print >> $$XFILE ; \
217 $(TAR) cvfX ./$$BASE.tar $$XFILE $$BASE; \
220 echo "compressing ../$$BASE.tar..."; \
221 $(COMPRESS) ../$$BASE.tar
224 # rule to force check for change of platform
227 @if [ -f .make-platform ]; then \
228 echo "removing old link .make-platform"; \
229 $(RM) .make-platform; \
231 $(MAKE) $(MFLAGS) .make-platform
234 makeconfig: .makefiles buildtools
237 @if [ -f /usr/bin/swconfig ]; then \
238 UNAME=./build/uname.sh; \
239 elif [ -f /bin/uname ]; then \
241 elif [ -f /usr/bin/uname ]; then \
242 UNAME=/usr/bin/uname; \
244 UNAME=./build/uname.sh; \
246 if [ -z "$$UNAME" ]; then \
247 echo "unknown platform (no $$UNAME or /usr/bin/uname)"; \
248 echo "see the file build/PORTS for more information."; \
251 OS=`$$UNAME -s` ; OSRELEASE=`$$UNAME -r` ; \
252 OSVERSION=`$$UNAME -v` ; \
255 if [ $$OSRELEASE -gt "5" -o $$OSRELEASE -lt "4" ]; then \
256 echo "SunOS release $$OSRELEASE unknown..."; exit 1; \
258 if [ $$OSRELEASE -ge "5" ]; then \
259 MINORVER=`echo $$OSRELEASE|sed 's/^.*\.//'` ; \
260 if [ $$MINORVER -ge "6" ]; then \
261 PLATFORM="sunos56" ; \
291 PLATFORM="nextstep" \
299 *) echo "unknown platform ($$OS $$OSVERSION $$OSRELEASE)..."; \
300 echo "see the file build/PORTS for more information."; \
308 for dir in $$PATH; do \
309 if [ -f $$dir/gcc ]; then \
315 $(LN) ./build/platforms/$$PLATFORM-$$CC/Make-platform .make-platform; \
317 echo "** Set platform to $$PLATFORM with compiler $$CC..."; \
320 Make-common: Make-common.dist
321 @if [ -f Make-common ]; then \
322 echo "Make-common.dist newer than Make-common, check for new options" ;\
323 echo "or touch Make-common to ignore."; \
326 cp Make-common.dist Make-common; \
327 echo "Make-common installed from distribution." ; \
328 echo " Edit as needed before making!" ; \
331 # rule to build Makefiles by concatenating Make-template file in each
332 # subdirectory with global Make-common, .make-platform, and
333 # build/Make-append files
335 .makefiles: Make-common .make-platform build/Make-append
336 @echo "making Makefiles..."; \
337 HDRFILE=/tmp/Makehdr.$$$$; \
338 DEFSFILE=/tmp/Makedefs.$$$$; \
339 $(CAT) build/Make-append ./.make-platform ./Make-common > $$DEFSFILE; \
340 echo "# --------------------------------------------------------" > $$HDRFILE; \
341 echo "# This file was automatically generated. Do not edit it." >> $$HDRFILE; \
342 echo "# Instead, edit the Make-common file (located in the root" >> $$HDRFILE; \
343 echo "# (of the LDAP distribution). See the LDAP INSTALL file" >> $$HDRFILE; \
344 echo "# for more information." >> $$HDRFILE; \
345 echo "# --------------------------------------------------------" >> $$HDRFILE; \
346 echo "#" >> $$HDRFILE; \
347 for i in `$(FIND) . -type d -print`; do \
348 if [ -f $$i/Make-template ]; then \
349 echo " creating $$i/Makefile"; \
350 $(RM) $$i/Makefile; \
351 $(CAT) $$HDRFILE $$i/Make-template $$DEFSFILE > $$i/Makefile; \
356 $(RM) $$HDRFILE $$DEFSFILE \
357 echo "Please \"make depend\" before building."
361 # rule to always build makefiles
365 $(MAKE) $(MFLAGS) .makefiles
368 # rule to create any tools we need to build everything else
371 @echo "making buildtools"
372 @echo " cd build; $(MAKE) $(MFLAGS)"
373 @( cd build; $(MAKE) $(MFLAGS) )
376 # rule to make a shadow (linked) build area
379 @if [ -f /usr/bin/swconfig ]; then \
380 UNAME=./build/uname.sh; \
381 elif [ -f /bin/uname ]; then \
383 elif [ -f /usr/bin/uname ]; then \
384 UNAME=/usr/bin/uname; \
386 UNAME=./build/uname.sh; \
388 if [ ! -z "$(DEST)" ]; then \
391 DEST=./obj-`$$UNAME -s`-`$$UNAME -r` ; \
393 echo "making links in $$DEST..."; \
394 LINKLIST=/tmp/ldaplinklist.$$$$; \
397 cd $$DEST; $(LN) $(LDAPSRC) .src; \
398 $(LN) .src/Makefile . ; \
399 $(CP) .src/Make-common . ; $(CHMOD) 644 ./Make-common; \
400 for d in build $(SRCDIRS) $(TESTDIR); do \
401 ( $(MKDIR) $$d; cd $$d; $(LN) ../.src/$$d .src; \
402 $(LN) .src/Make-template . ; \
403 $(MAKE) $(MFLAGS) MKDIR="$(MKDIR)" LN="$(LN)" \
404 -f Make-template links ) ; \
406 echo ""; echo "Now type:"; echo " cd $$DEST"; echo "and make there"