OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / lib / pwlib / make / common.mak
1 #
2 # common.mak
3 #
4 # Common make rules included in ptlib.mak and pwlib.mak
5 #
6 # Portable Windows Library
7 #
8 # Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9 #
10 # The contents of this file are subject to the Mozilla Public License
11 # Version 1.0 (the "License"); you may not use this file except in
12 # compliance with the License. You may obtain a copy of the License at
13 # http://www.mozilla.org/MPL/
14 #
15 # Software distributed under the License is distributed on an "AS IS"
16 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 # the License for the specific language governing rights and limitations
18 # under the License.
19 #
20 # The Original Code is Portable Windows Library.
21 #
22 # The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23 #
24 # Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 # All Rights Reserved.
26
27 # Contributor(s): ______________________________________.
28 #
29 # $Log: common.mak,v $
30 # Revision 1.95  2006/01/08 14:49:08  dsandras
31 # Several fixes to allow compilation on Open Solaris thanks to Brian Lu <brian.lu _AT_____ sun.com>. Many thanks!
32 #
33 # Revision 1.94  2004/06/10 01:36:44  csoutheren
34 # Fixed problems with static links
35 #
36 # Revision 1.93  2004/04/29 14:07:07  csoutheren
37 # Changed install target to use $(INSTALL)
38 # Various makefile cleanups and verified install and uninstall targets
39 # Removed some vestiges of old GUI code
40 #
41 # Revision 1.92  2004/04/24 06:26:03  rjongbloed
42 # Fixed very bizarre problem with GNU GCC 3.4.0 and generating dependencies,
43 #   cannot have -g and -M on the command line at the same time!
44 #
45 # Revision 1.91  2004/04/21 12:05:04  csoutheren
46 # Added target to create gcc compiled header for ptlib.h, but not used
47 # because it does not seem to be able to compile some files
48 #
49 # Revision 1.90  2004/04/14 10:21:15  csoutheren
50 # Grrr...more changes for CXX flags
51 #
52 # Revision 1.89  2004/04/14 10:07:00  csoutheren
53 # Added CXXFLAGS
54 #
55 # Revision 1.88  2003/12/29 07:15:31  csoutheren
56 # Fixed problem with creating statically linked executables
57 #
58 # Revision 1.87  2003/11/02 15:57:56  shawn
59 # remove -static for Mac OS X
60 #
61 # Revision 1.86  2003/10/03 00:36:59  dereksmithies
62 # Fix generation of dependencies. Thanks to Vyacheslav Frolov
63 #
64 # Revision 1.85  2003/07/29 11:25:23  csoutheren
65 # Added support for system swab function
66 #
67 # Revision 1.84  2003/07/24 22:01:42  dereksmithies
68 # Add fixes from Peter Nixon  for fixing install problems. Thanks.
69 #
70 # Revision 1.83  2003/06/17 12:05:01  csoutheren
71 # Changed compiler flags for optimised build
72 #
73 # Revision 1.82  2003/02/03 06:08:52  robertj
74 # Changed tagbuild so leaves a cvs sticky version of sources to that tag.
75 #
76 # Revision 1.81  2002/11/15 06:36:59  robertj
77 # Changed so library build only occurs if source is present.
78 #
79 # Revision 1.80  2002/10/10 04:43:44  robertj
80 # VxWorks port, thanks Martijn Roest
81 #
82 # Revision 1.79  2002/08/30 11:41:33  robertj
83 # Added guarantee that version numbers exist.
84 #
85 # Revision 1.78  2002/08/30 02:23:13  craigs
86 # Added changes for correct creation of debug libraries
87 #    thanks to Martin Froehlich
88 #
89 # Revision 1.77  2002/06/25 04:13:07  robertj
90 # Added symbol NODEPS so dependency files are not included, very useful for
91 #   when they get corrupted so don;t have to manually delete them.
92 #
93 # Revision 1.76  2002/04/08 00:41:50  robertj
94 # Added dependency build to "make libs" target.
95 #
96 # Revision 1.75  2002/04/01 09:14:09  rogerh
97 # Add noshared build targets
98 #
99 # Revision 1.74  2002/02/25 16:23:16  rogerh
100 # Test for GCC 3 in unix.mak and not it common.mak so -DGCC3 can be set
101 #
102 # Revision 1.73  2002/02/19 06:26:29  rogerh
103 # Move $$BLD outside quotes so it gets expanded correctly
104 #
105 # Revision 1.72  2002/02/18 07:39:04  robertj
106 # Changed version number increment to more portable expr function.
107 #
108 # Revision 1.71  2002/01/28 10:33:20  rogerh
109 # use CPLUS instead of gcc. Makes it work on Mac OS X
110 #
111 # Revision 1.70  2002/01/28 00:19:59  craigs
112 # Made gcc 3 changes dependent on having gcc 3.0 installed
113 #
114 # Revision 1.69  2001/12/17 23:33:50  robertj
115 # Solaris 8 porting changes, thanks James Dugal
116 #
117 # Revision 1.68  2001/11/29 07:50:42  robertj
118 # Removed static, it doesn't work either
119 #
120 # Revision 1.67  2001/11/29 03:16:49  robertj
121 # Made make noshared completely static
122 #
123 # Revision 1.66  2001/11/28 02:44:14  robertj
124 # Fixed attempt to do static link on debug version, causes crashes.
125 #
126 # Revision 1.65  2001/11/27 22:42:13  robertj
127 # Changed to make system to better support non-shared library building.
128 #
129 # Revision 1.64  2001/10/31 00:45:20  robertj
130 # Added debuglibs, optlibs and bothlibs targets, moving help to where these
131 #   targets are in teh make file system.
132 #
133 # Revision 1.63  2001/10/12 07:25:33  robertj
134 # Removed diff test, cvs commit already does compare
135 #
136 # Revision 1.62  2001/10/12 06:18:41  robertj
137 # Fixed check of change of version file for tagbuild
138 #
139 # Revision 1.61  2001/10/09 08:53:26  robertj
140 # Added LIBDIRS variable so can go "make libs" and make all libraries.
141 # Added "make version" target to display version of project.
142 # Added inclusion of library versions into "make tagbuild" check in.
143 #
144 # Revision 1.60  2001/08/07 08:24:42  robertj
145 # Fixed bug in tagbuild if have more than one BUILD_NUMBER in file.
146 #
147 # Revision 1.59  2001/07/30 07:45:54  robertj
148 # Added "all" target with double colon.
149 #
150 # Revision 1.58  2001/07/27 14:39:12  robertj
151 # Allowed libs target to have multiple definitions
152 #
153 # Revision 1.57  2001/06/30 06:59:06  yurik
154 # Jac Goudsmit from Be submit these changes 6/28. Implemented by Yuri Kiryanov
155 #
156 # Revision 1.56  2001/06/29 06:47:30  robertj
157 # Added missing dollar sign
158 #
159 # Revision 1.55  2001/06/29 06:41:03  robertj
160 # Fixed make tagbuild for different #defines
161 #
162 # Revision 1.54  2001/05/29 03:31:48  craigs
163 # Removed BROKEN_GCC symbol, now that pwlib is totally gcc friendly
164 #
165 # Revision 1.53  2001/03/29 04:48:45  robertj
166 # Added tagbuild target to do CVS tag and autoincrement BUILD_NUMBER
167 # Changed order so version.h is used before custom.cxx
168 #
169 # Revision 1.52  2001/03/23 19:59:48  craigs
170 # Added detection of broken gcc versions
171 #
172 # Revision 1.51  2001/03/22 01:14:16  robertj
173 # Allowed for the version file #defines to configured by calling makefile.
174 #
175 # Revision 1.50  2000/11/02 04:46:42  craigs
176 # Added support for buildnum.h file for version numbers
177 #
178 # Revision 1.49  2000/10/01 01:08:10  craigs
179 # Fixed problems with Motif build
180 #
181 # Revision 1.48  2000/09/20 23:59:35  craigs
182 # Fixed problem with bothnoshared target
183 #
184 # Revision 1.47  2000/04/26 00:40:48  robertj
185 # Redesigned version number system to have single file to change on releases.
186 #
187 # Revision 1.46  2000/04/06 20:12:33  craigs
188 # Added install targets
189 #
190 # Revision 1.45  2000/03/20 23:08:31  craigs
191 # Added showgui target to allow displaying the GUI settings
192 #
193 # Revision 1.44  2000/03/20 22:43:09  craigs
194 # Added totally new mechanism for detecting GUI
195 #
196 # Revision 1.43  2000/03/03 00:37:42  robertj
197 # Fixed problem for when have GUI environment variable set, always builds GUI!
198 #
199 # Revision 1.42  2000/02/24 11:02:11  craigs
200 # Fixed problems with PW make
201 #
202 # Revision 1.41  2000/02/16 11:30:25  craigs
203 # Added rule to force library build for applications
204 #
205 # Revision 1.40  2000/02/04 19:33:25  craigs
206 # Added ability to create non-shared versions of programs
207 #
208 # Revision 1.39  2000/01/22 00:51:18  craigs
209 # Added ability to compile in any directory, and to create shared libs
210 #
211 # Revision 1.38  1999/07/10 03:32:02  robertj
212 # Improved release version detection code.
213 #
214 # Revision 1.37  1999/07/03 04:31:53  robertj
215 # Fixed problems with not including oss.cxx in library if OSTYPE not "linux"
216 #
217 # Revision 1.36  1999/07/02 05:10:33  robertj
218 # Fixed bug in changing from debug default to opt build
219 #
220 # Revision 1.35  1999/06/28 09:12:01  robertj
221 # Fixed problems with the order in which macros are defined especially on BeOS & Solaris
222 #
223 # Revision 1.34  1999/06/27 02:42:10  robertj
224 # Fixed BeOS compatability.
225 # Fixed error of platform name not supported, needed :: on main targets.
226 #
227 # Revision 1.33  1999/06/09 15:41:18  robertj
228 # Added better UI to make files.
229 #
230 # Revision 1.32  1999/04/18 09:36:31  robertj
231 # Get date grammar build.
232 #
233 # Revision 1.31  1999/02/19 11:32:10  robertj
234 # Improved the "release" target to build release tar files.
235 #
236 # Revision 1.30  1999/01/16 09:56:24  robertj
237 # Changed some macros to more informative names.
238 #
239 # Revision 1.29  1999/01/16 04:00:05  robertj
240 # Added bothclean target
241 #
242 # Revision 1.28  1998/12/02 02:36:57  robertj
243 # New directory structure.
244 #
245 # Revision 1.27  1998/11/26 12:48:20  robertj
246 # Support for .c files.
247 #
248 # Revision 1.26  1998/11/26 11:40:03  craigs
249 # Added checking for resource compilation
250 #
251 # Revision 1.25  1998/11/26 07:29:19  craigs
252 # Yet another bash at a GUI build environment
253 #
254 # Revision 1.24  1998/11/24 03:41:32  robertj
255 # Fixed problem where failed make depend leaves bad .dep files behind
256 #
257 # Revision 1.23  1998/11/22 10:41:02  craigs
258 # New GUI build system - for sure!
259 #
260 # Revision 1.22  1998/11/22 08:11:31  craigs
261 # *** empty log message ***
262 #
263 # Revision 1.21  1998/09/24 04:20:49  robertj
264 # Added open software license.
265 #
266
267 ######################################################################
268 #
269 # common rules
270 #
271 ######################################################################
272
273 # Submodules built with make lib
274 LIBDIRS += $(PWLIBDIR)
275
276
277 ifndef OBJDIR
278 OBJDIR  =       ./$(PT_OBJBASE)
279 endif
280
281 vpath %.cxx $(VPATH_CXX)
282 vpath %.c   $(VPATH_C)
283 vpath %.o   $(OBJDIR)
284 vpath %.dep $(DEPDIR)
285 vpath %.gch $(PWLIBDIR)/include
286
287 #
288 # add common directory to include path - must be after PW and PT directories
289 #
290 STDCCFLAGS      += -I$(PWLIBDIR)/include
291
292 ifneq ($(P_SHAREDLIB),1)
293
294 #ifneq ($(OSTYPE),Darwin) # Mac OS X does not really support -static
295 #LDFLAGS += -static
296 #endif
297
298 ifneq ($(P_STATIC_LDFLAGS),)
299 LDFLAGS += $(P_STATIC_LDFLAGS)
300 endif
301
302 ifneq ($(P_STATIC_ENDLDLIBS),)
303 ENDLDLIBS += $(P_STATIC_ENDLDLIBS)
304 endif
305
306 endif
307
308 #  clean whitespace out of source file list
309 SOURCES         := $(strip $(SOURCES))
310
311 #
312 # define rule for .cxx and .c files
313 #
314 $(OBJDIR)/%.o : %.cxx 
315         @if [ ! -d $(OBJDIR) ] ; then mkdir -p $(OBJDIR) ; fi
316         $(CPLUS) $(STDCCFLAGS) $(OPTCCFLAGS) $(CFLAGS) $(STDCXXFLAGS) -c $< -o $@
317
318 $(OBJDIR)/%.o : %.c 
319         @if [ ! -d $(OBJDIR) ] ; then mkdir -p $(OBJDIR) ; fi
320         $(CC) $(STDCCFLAGS) $(OPTCCFLAGS) $(CFLAGS) -c $< -o $@
321
322 #
323 # create list of object files 
324 #
325 SRC_OBJS := $(SOURCES:.c=.o)
326 SRC_OBJS := $(SRC_OBJS:.cxx=.o)
327 OBJS     := $(EXTERNALOBJS) $(patsubst %.o, $(OBJDIR)/%.o, $(notdir $(SRC_OBJS) $(OBJS)))
328
329 #
330 # create list of dependency files 
331 #
332 DEPDIR   := $(OBJDIR)
333 SRC_DEPS := $(SOURCES:.c=.dep)
334 SRC_DEPS := $(SRC_DEPS:.cxx=.dep)
335 DEPS     := $(patsubst %.dep, $(DEPDIR)/%.dep, $(notdir $(SRC_DEPS) $(DEPS)))
336
337 #
338 # define rule for .dep files
339 #
340 $(DEPDIR)/%.dep : %.cxx 
341         @if [ ! -d $(DEPDIR) ] ; then mkdir -p $(DEPDIR) ; fi
342         @printf %s $(OBJDIR)/ > $@
343         $(CPLUS) $(STDCCFLAGS:-g=) -M $< >> $@
344
345 $(DEPDIR)/%.dep : %.c 
346         @if [ ! -d $(DEPDIR) ] ; then mkdir -p $(DEPDIR) ; fi
347         @printf %s $(OBJDIR)/ > $@
348         $(CC) $(STDCCFLAGS:-g=) -M $< >> $@
349
350 #
351 # add in good files to delete
352 #
353 CLEAN_FILES += $(OBJS) $(DEPS) core
354
355 ######################################################################
356 #
357 # rules for application
358 #
359 ######################################################################
360
361 ifdef   PROG
362
363 ifndef TARGET
364 TARGET = $(OBJDIR)/$(PROG)
365 endif
366
367 ifdef BUILDFILES
368 OBJS += $(OBJDIR)/buildnum.o
369 endif
370
371 TARGET_LIBS     = $(PWLIBDIR)/lib/$(PTLIB_FILE)
372
373 # distinguish betweek building and using pwlib
374 ifeq (,$(wildcard $(PWLIBDIR)/src))
375 TARGET_LIBS     = $(SYSLIBDIR)/$(PTLIB_FILE)
376 endif
377
378 $(TARGET):      $(OBJS) $(TARGET_LIBS)
379 ifeq ($(OSTYPE),beos)
380 # BeOS won't find dynamic libraries unless they are in one of the system
381 # library directories or in the lib directory under the application's
382 # directory
383         @if [ ! -L $(OBJDIR)/lib ] ; then cd $(OBJDIR); ln -s $(PW_LIBDIR) lib; fi
384 endif
385         $(CPLUS) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) $(ENDLDLIBS) $(ENDLDFLAGS)
386 ifeq ($(OSTYPE),VxWorks)
387         $(LD)   --split-by-reloc 65535 -r   $(OBJS) -o $@ 
388 endif
389
390 ifdef DEBUG
391
392 ifneq (,$(wildcard $(PWLIBDIR)/src/ptlib/unix))
393 $(PW_LIBDIR)/$(PTLIB_FILE):
394         $(MAKE) -C $(PWLIBDIR)/src/ptlib/unix debug
395 endif
396
397 else
398
399 ifneq (,$(wildcard $(PWLIBDIR)/src/ptlib/unix))
400 $(PW_LIBDIR)/$(PTLIB_FILE):
401         $(MAKE) -C $(PWLIBDIR)/src/ptlib/unix opt
402 endif
403
404 endif
405
406 CLEAN_FILES += $(TARGET)
407
408 ifndef INSTALL_OVERRIDE
409
410 install:        $(TARGET)
411         $(INSTALL) $(TARGET) $(INSTALLBIN_DIR)
412 endif
413
414 # ifdef PROG
415 endif
416
417 $(PWLIBDIR)/include/ptlib.h.gch: $(PWLIBDIR)/include/ptlib.h
418         @if [ ! -d $(OBJDIR) ] ; then mkdir -p $(OBJDIR) ; fi
419         $(CPLUS) $(STDCCFLAGS) $(OPTCCFLAGS) $(CFLAGS) $(STDCXXFLAGS) -x c++ -c $< -o $@
420
421 PCH     := $(PWLIBDIR)/include/ptlib.h.gch
422
423 ######################################################################
424 #
425 # Main targets for build management
426 #
427 ######################################################################
428
429 all :: debuglibs debugdepend debug optlibs optdepend opt
430
431 help:
432         @echo "The following targets are available:"
433         @echo "  make debug         Make debug version of application"
434         @echo "  make opt           Make optimised version of application"
435         @echo "  make both          Make both versions of application"
436         @echo
437         @echo "  make debugnoshared Make static debug version of application"
438         @echo "  make optnoshared   Make static optimised version of application"
439         @echo "  make bothnoshared  Make static both versions of application"
440         @echo
441         @echo "  make debugclean    Remove debug files"
442         @echo "  make optclean      Remove optimised files"
443         @echo "  make clean         Remove both debug and optimised files"
444         @echo
445         @echo "  make debugdepend   Create debug dependency files"
446         @echo "  make optdepend     Create optimised dependency files"
447         @echo "  make bothdepend    Create both debug and optimised dependency files"
448         @echo
449         @echo "  make debuglibs     Make debug libraries project depends on"
450         @echo "  make optlibs       Make optimised libraries project depends on"
451         @echo "  make bothlibs      Make both debug and optimised libraries project depends on"
452         @echo
453         @echo "  make all           Create debug & optimised dependencies & libraries"
454         @echo
455         @echo "  make version       Display version for project"
456         @echo "  make tagbuild      Do a CVS tag of the source, and bump build number"
457         @echo "  make release       Package up optimised version int tar.gz file"
458
459
460 ifdef DEBUG
461
462 debug :: $(TARGET)
463
464 opt ::
465         @$(MAKE) DEBUG= opt
466
467 debugclean ::
468         rm -rf $(CLEAN_FILES)
469
470 optclean ::
471         @$(MAKE) DEBUG= optclean
472
473 .DELETE_ON_ERROR : debugdepend
474
475 debugdepend :: $(DEPS)
476         @echo Created dependencies.
477
478 optdepend ::
479         @$(MAKE) DEBUG= optdepend
480
481 debuglibs :: libs
482
483 optlibs ::
484         @$(MAKE) DEBUG= libs
485
486 libs ::
487         set -e; for i in $(LIBDIRS); do $(MAKE) -C $$i debugdepend debug; done
488
489 else
490
491 debug ::
492         @$(MAKE) DEBUG=1 debug
493
494 opt :: $(TARGET)
495
496 debugclean ::
497         @$(MAKE) DEBUG=1 debugclean
498
499 optclean ::
500         rm -rf $(CLEAN_FILES)
501
502 .DELETE_ON_ERROR : optdepend
503
504 debugdepend ::
505         @$(MAKE) DEBUG=1 debugdepend
506
507 optdepend :: $(DEPS)
508         @echo Created dependencies.
509
510 debuglibs ::
511         @$(MAKE) DEBUG=1 libs
512
513 optlibs :: libs
514
515 libs ::
516         set -e; for i in $(LIBDIRS); do $(MAKE) -C $$i optdepend opt; done
517
518 endif
519
520 both :: opt debug
521 clean :: optclean debugclean
522 bothdepend :: optdepend debugdepend
523 bothlibs :: optlibs debuglibs
524
525 optshared ::
526         $(MAKE) P_SHAREDLIB=1 opt
527
528 debugshared ::
529         $(MAKE) P_SHAREDLIB=1 debug
530
531 bothshared ::
532         $(MAKE) optshared debugshared
533
534 optnoshared ::
535         $(MAKE) P_SHAREDLIB=0 opt
536
537 debugnoshared ::
538         $(MAKE) P_SHAREDLIB=0 debug
539
540 bothnoshared ::
541         $(MAKE) optnoshared debugnoshared
542
543
544
545 ######################################################################
546 #
547 # common rule to make a release of the program
548 #
549 ######################################################################
550
551 # if have not explictly defined VERSION_FILE, locate a default
552
553 ifndef VERSION_FILE
554   ifneq (,$(wildcard buildnum.h))
555     VERSION_FILE := buildnum.h
556   else
557     ifneq (,$(wildcard version.h))
558       VERSION_FILE := version.h
559     else
560       ifneq (,$(wildcard custom.cxx))
561         VERSION_FILE := custom.cxx
562       endif
563     endif
564   endif
565 endif
566
567
568 ifdef VERSION_FILE
569
570 # Set default strings to search in VERSION_FILE
571   ifndef MAJOR_VERSION_DEFINE
572     MAJOR_VERSION_DEFINE:=MAJOR_VERSION
573   endif
574   ifndef MINOR_VERSION_DEFINE
575     MINOR_VERSION_DEFINE:=MINOR_VERSION
576   endif
577   ifndef BUILD_NUMBER_DEFINE
578     BUILD_NUMBER_DEFINE:=BUILD_NUMBER
579   endif
580
581
582 # If not specified, find the various version components in the VERSION_FILE
583
584   ifndef MAJOR_VERSION
585     MAJOR_VERSION:=$(strip $(subst \#define,, $(subst $(MAJOR_VERSION_DEFINE),,\
586                    $(shell grep "define *$(MAJOR_VERSION_DEFINE) *" $(VERSION_FILE)))))
587   endif
588   ifndef MINOR_VERSION
589     MINOR_VERSION:=$(strip $(subst \#define,, $(subst $(MINOR_VERSION_DEFINE),,\
590                    $(shell grep "define *$(MINOR_VERSION_DEFINE)" $(VERSION_FILE)))))
591   endif
592   ifndef BUILD_TYPE
593     BUILD_TYPE:=$(strip $(subst \#define,,$(subst BUILD_TYPE,,\
594                 $(subst AlphaCode,alpha,$(subst BetaCode,beta,$(subst ReleaseCode,.,\
595                 $(shell grep "define *BUILD_TYPE" $(VERSION_FILE))))))))
596   endif
597   ifndef BUILD_NUMBER
598     BUILD_NUMBER:=$(strip $(subst \#define,,$(subst $(BUILD_NUMBER_DEFINE),,\
599                   $(shell grep "define *$(BUILD_NUMBER_DEFINE)" $(VERSION_FILE)))))
600   endif
601
602 # Finally check that version numbers are not empty
603
604   ifeq (,$(MAJOR_VERSION))
605     override MAJOR_VERSION:=1
606   endif
607   ifeq (,$(MINOR_VERSION))
608     override MINOR_VERSION:=0
609   endif
610   ifeq (,$(BUILD_TYPE))
611     override BUILD_TYPE:=alpha
612   endif
613   ifeq (,$(BUILD_NUMBER))
614     override BUILD_NUMBER:=0
615   endif
616
617 # Check for VERSION either predefined or defined by previous section from VERSION_FILE
618   ifndef VERSION
619     VERSION:=$(MAJOR_VERSION).$(MINOR_VERSION)$(BUILD_TYPE)$(BUILD_NUMBER)
620   endif # ifndef VERSION
621 endif # ifdef VERSION_FILE
622
623 # Build the CVS_TAG string from the components
624 ifndef CVS_TAG
625   CVS_TAG := v$(MAJOR_VERSION)_$(MINOR_VERSION)$(subst .,_,$(BUILD_TYPE))$(BUILD_NUMBER)
626 endif
627
628 ifdef DEBUG
629
630 # Cannot do this in DEBUG mode, so do it without DEBUG
631
632 release ::
633         $(MAKE) DEBUG= release
634
635 else
636
637
638 ifndef VERSION
639
640 release ::
641         @echo Must define VERSION macro or have version.h/custom.cxx file.
642
643 tagbuild ::
644         @echo Must define VERSION macro or have version.h/custom.cxx file.
645
646 else # ifdef VERSION
647
648 # "make release" definition
649
650 ifndef RELEASEDIR
651 RELEASEDIR=releases
652 endif
653
654 ifndef RELEASEBASEDIR
655 RELEASEBASEDIR=$(PROG)
656 endif
657
658 RELEASEPROGDIR=$(RELEASEDIR)/$(RELEASEBASEDIR)
659
660 release :: $(TARGET) releasefiles
661         cp $(TARGET) $(RELEASEPROGDIR)/$(PROG)
662         cd $(RELEASEDIR) ; tar chf - $(RELEASEBASEDIR) | gzip > $(PROG)_$(VERSION)_$(PLATFORM_TYPE).tar.gz
663         rm -r $(RELEASEPROGDIR)
664
665 releasefiles ::
666         -mkdir -p $(RELEASEPROGDIR)
667
668
669 version:
670         @echo v$(VERSION) "  CVS tag:" `cvs status Makefile | grep "Sticky Tag" | sed -e "s/(none)/HEAD/" -e "s/(.*)//" -e "s/^.*://"`
671
672
673 ifndef VERSION_FILE
674
675 tagbuild ::
676         @echo Must define VERSION_FILE macro or have version.h/custom.cxx file.
677
678 else # ifndef VERSION_FILE
679
680 ifndef CVS_TAG
681
682 tagbuild ::
683         @echo Must define CVS_TAG macro or have version.h/custom.cxx file.
684
685 else # ifndef CVS_TAG
686
687 tagbuild ::
688         sed $(foreach dir,$(LIBDIRS), -e "s/ $(notdir $(dir)):.*/ $(notdir $(dir)): $(shell $(MAKE) -s -C $(dir) version)/") $(VERSION_FILE) > $(VERSION_FILE).new
689         mv -f $(VERSION_FILE).new $(VERSION_FILE)
690         cvs commit -m "Pre-tagging check in for $(CVS_TAG)." $(VERSION_FILE)
691         cvs tag -c $(CVS_TAG)
692         BLD=`expr $(BUILD_NUMBER) + 1` ; \
693         echo "Incrementing to build number " $$BLD; \
694         sed "s/$(BUILD_NUMBER_DEFINE)[ ]*[0-9][0-9]*/$(BUILD_NUMBER_DEFINE) $$BLD/" $(VERSION_FILE) > $(VERSION_FILE).new
695         mv -f $(VERSION_FILE).new $(VERSION_FILE)
696         cvs commit -m "Incremented build number after tagging to $(CVS_TAG)." $(VERSION_FILE)
697         cvs -q update -r $(CVS_TAG)
698
699 endif # else ifndef CVS_TAG
700
701 endif # else ifndef VERSION_FILE
702
703 endif # else ifdef VERSION
704
705 endif # else ifdef DEBUG
706
707
708 ######################################################################
709 #
710 # rules for creating build number files
711 #
712 ######################################################################
713
714 ifdef BUILDFILES
715 $(OBJDIR)/buildnum.o:   buildnum.c
716         cc -o $(OBJDIR)/buildnum.o -c buildnum.c
717
718 #ifndef DEBUG
719 #buildnum.c:    $(SOURCES) $(BUILDFILES) 
720 #       buildinc buildnum.c
721 #else
722 buildnum.c:
723 #endif
724
725 endif
726
727 ######################################################################
728 #
729 # Include all of the dependencies
730 #
731 ######################################################################
732
733 ifndef NODEPS
734 -include $(DEPDIR)/*.dep
735 endif
736
737
738 # End of common.mak
739