1 # Makefile for GNU C++ class library (libg++)
2 # Copyright (C) 1989 Free Software Foundation, Inc.
3 # written by Doug Lea (dl@rocky.oswego.edu)
5 #This file is part of GNU libg++.
7 #GNU libg++ is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 1, or (at your option)
12 #GNU libg++ is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GNU libg++; see the file COPYING. If not, write to
19 #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 ###########################################################################
23 # Directories, paths, compilation flags and program names.
25 # Please make sure these are correct.
28 # ------ source locations
30 # Manually set PWD to *this* directory if you are not using gnu make
34 # source include directory
35 SRCIDIR= $(PWD)/g++-include
37 # the genclass program
38 GENCLASS=$(PWD)/genclass
39 # and its directory of prototype files
40 PROTODIR=$(PWD)/g++-include/gen
42 # ------ installation destinations
43 # ------ You will require write-permission on the destination directories
44 # ------ in order to `make install'
46 # set `prefix' to something else if you want to install things
47 # in nonstandard places
51 # libg++.a destination
52 LIBDIR = $(prefix)/lib
54 # executables directory: location to install the genclass class generator
55 BINDIR = $(prefix)/bin
57 # directory to install man pages
60 # location to install include file directory
61 IDIR = $(prefix)/lib/g++-include
64 # ------- System-dependent defines
65 # ------- use the second form of each for SystemV (USG)
71 # other compilation control flags -- use any combination
73 # use this only if you have a strange stdio implementation
74 #XTRAFLAGS = -DDEFAULT_filebuf
76 # use this if you do not want gnulib3 in libg++.a
77 #XTRAFLAGS = -DNO_GNULIB3
79 # use this if you need COFF encapulation defined in gnulib3
80 #XTRAFLAGS = -DCOFF_ENCAPSULATE
82 # use this if you want to disable line buffering for stream output
83 #XTRAFLAGS = -DNO_LINE_BUFFER_STREAMBUF
85 # Use this to disable placing libg++ version of malloc in libg++.a
86 #XTRAFLAGS = -DNO_LIBGXX_MALLOC
88 # Please use this & send me some results of malloc_stats() sometime
89 # (it is off by default, since stat gathering hurts performance)
90 #XTRAFLAGS = -DMALLOC_STATS
92 #suggested for NeXT by cdr@acc.stolaf.edu
93 #XTRAFLAGS = -DNO_GNULIB3 -DNO_LIBGXX_MALLOC
103 # ranlib if necessary
113 # not used, but convenient for those who preprocess things while compiling
117 # ------ compiler names
119 # GNU C++ compiler name
123 # GNU CC compiler name (needed for some .c files in libg++.a)
127 LDXX = $(LIBDIR)/gcc-ld
128 #LDXX = $(LIBDIR)/gcc-ld++
130 # crt0+.o location (for dynamic loading tests)
131 GXXCRT1=$(LIBDIR)/crt1+.o
133 # ------ Other compilation flags
134 # ------ modify as you like -- the ones here are sheer overkill
135 # ------ However, You MUST compile libg++.a with EITHER -O OR
136 # ------ -DUSE_LIBGXX_INLINES or both
138 GXX_OPTIMIZATION_FLAGS= -O -fstrength-reduce -felide-constructors -fschedule-insns -fdelayed-branch -fsave-memoized
140 #GXX_OPTIMIZATION_FLAGS=-DUSE_LIBGXX_INLINES
142 GCC_OPTIMIZATION_FLAGS= -O -fstrength-reduce -fdelayed-branch
146 #use this only if you like to look at lots of useless messages
147 #VERBOSITY_FLAGS= -Wall -v
148 VERBOSITY_FLAGS= -Wall
150 GXX_INCLUDE_DIRS= -I$(SRCIDIR)
152 GCC_INCLUDE_DIRS= -I$(prefix)/lib/gcc-include -I/usr/include -I$(SRCIDIR)
154 #use this only if you use GNU as (gas) or other assemblers that
155 #can read from pipes.
159 # Flags for all C++ compiles
160 GXXFLAGS = $(OSFLAG) $(GXX_INCLUDE_DIRS) $(DEBUG_FLAGS) $(GXX_OPTIMIZATION_FLAGS) $(VERBOSITY_FLAGS) $(XTRAFLAGS) $(PIPE_AS)
162 # Flags for all C compiles
163 CFLAGS= $(OSFLAG) $(GCC_INCLUDE_DIRS) $(DEBUG_FLAGS) $(GCC_OPTIMIZATION_FLAGS) $(VERBOSITY_FLAGS) $(XTRAFLAGS) $(PIPE_AS)
165 # g++ load time flags
166 GXXLDFLAGS = -L$(PWD)/src -lg++ -lm $(OSLDFLAG)
168 # Comment out the next line to disable incremental linking test
169 # (this test NOT included in 1.39.0, so don't re-enable)
173 ###########################################################################
175 # compilation actions
182 (cd src; $(MAKE) GXX="$(GXX)" GXXFLAGS="$(GXXFLAGS)" GXXLDFLAGS="$(GXXLDFLAGS)" LIBDIR="$(LIBDIR)" SRCIDIR="$(SRCIDIR)" CC="$(CC)" CFLAGS="$(CFLAGS)" RANLIB="$(RANLIB)" LDXX="$(LDXX)" GXXCRT1="$(GXXCRT1)" MAKE="$(MAKE)" prefix="$(prefix)" VPATH="$(SRCIDIR)" AR="$(AR)" PROTODIR="$(PROTODIR)" GENCLASS="$(GENCLASS)")
185 (cd tests; $(MAKE) checktests GXX="$(GXX)" GXXFLAGS="$(GXXFLAGS)" GXXLDFLAGS="$(GXXLDFLAGS)" LIBDIR="$(LIBDIR)" SRCIDIR="$(SRCIDIR)" CC="$(CC)" CFLAGS="$(CFLAGS)" RANLIB="$(RANLIB)" LDXX="$(LDXX)" GXXCRT1="$(GXXCRT1)" MAKE="$(MAKE)" prefix="$(prefix)" AR="$(AR)" TEST0="$(TEST0)" PROTODIR="$(PROTODIR)" GENCLASS="$(GENCLASS)")
188 (cd etc; $(MAKE) GXX="$(GXX)" GXXFLAGS="$(GXXFLAGS)" GXXLDFLAGS="$(GXXLDFLAGS)" LIBDIR="$(LIBDIR)" SRCIDIR="$(SRCIDIR)" CC="$(CC)" CFLAGS="$(CFLAGS)" RANLIB="$(RANLIB)" LDXX="$(LDXX)" GXXCRT1="$(GXXCRT1)" MAKE="$(MAKE)" prefix="$(prefix)" AR="$(AR)" PROTODIR="$(PROTODIR)" GENCLASS="$(GENCLASS)")
191 (cd etc; $(MAKE) run_tests GXX="$(GXX)" GXXFLAGS="$(GXXFLAGS)" GXXLDFLAGS="$(GXXLDFLAGS)" LIBDIR="$(LIBDIR)" SRCIDIR="$(SRCIDIR)" CC="$(CC)" CFLAGS="$(CFLAGS)" RANLIB="$(RANLIB)" LDXX="$(LDXX)" GXXCRT1="$(GXXCRT1)" MAKE="$(MAKE)" prefix="$(prefix)" AR="$(AR)" PROTODIR="$(PROTODIR)" GENCLASS="$(GENCLASS)")
194 (cd gperf; $(MAKE) GXX="$(GXX)" GXXFLAGS="$(GXXFLAGS)" GXXLDFLAGS="$(GXXLDFLAGS)" LIBDIR="$(LIBDIR)" SRCIDIR="$(SRCIDIR)" CC="$(CC)" CFLAGS="$(CFLAGS)" RANLIB="$(RANLIB)" LDXX="$(LDXX)" GXXCRT1="$(GXXCRT1)" prefix="$(prefix)" AR="$(AR)" PROTODIR="$(PROTODIR)" GENCLASS="$(GENCLASS)")
196 genclass: genclass.sh
197 echo "/^PROTODIR=/c\\" > sedscript
198 echo "PROTODIR=$$\{PROTODIR-$(IDIR)/gen\}" >> sedscript
199 sed -f sedscript < genclass.sh > genclass
207 ###########################################################################
218 all: src tests genclass etc gperf
220 install: install-lib install-include-files install-progs
223 (cd src; $(MAKE) $(MAKE_ENVIRON) install)
226 (cd etc; $(MAKE) $(MAKE_ENVIRON) install)
227 (cd gperf; $(MAKE) $(MAKE_ENVIRON) install)
228 $(INSTALL) genclass $(BINDIR)
230 install-include-files:
235 FILES=`find . ! -type d -print`; \
237 GFILES=`find . ! -type d -print`;\
242 FILES=`find . ! -type d -print`; \
243 for file in $$FILES; do \
244 rm -f $(IDIR)/$$file; \
245 cp $$file $(IDIR)/$$file; \
246 chmod 0444 $(IDIR)/$$file; \
247 echo $$file installed; \
251 ###########################################################################
257 rm -f *.o *~ \#* *.bak *.pl a.out
258 cd tests; $(MAKE) clean
259 cd etc; $(MAKE) clean
260 cd gperf; $(MAKE) clean
263 cd src; $(MAKE) realclean
264 cd tests; $(MAKE) realclean
265 cd etc; $(MAKE) realclean
266 cd gperf; $(MAKE) realclean
268 -rm -f libg++.info* libg++.?? libg++.??s libg++.log libg++.toc libg++.*aux
269 -rm -f *.orig src/*.orig tests/*.orig etc/*.orig g++-include/*.orig g++-include/sys/*.orig g++-include/gen/*.orig
270 -rm -f *.rej src/*.rej tests/*.rej etc/*.rej g++-include/*.rej g++-include/sys/*.rej g++-include/gen/*.rej
271 -rm -f *~ src/*~ tests/*~ etc/*~ g++-include/*~ g++-include/sys/*~ g++-include/gen/*~
272 -rm -f a.out src/a.out tests/a.out etc/a.out
273 -rm -f *.s src/*.s tests/*.s etc/*.s
276 .PHONY: src tests genclass etc gperf FORCE install install-include-files