# -*- Makefile -*- # # $Id: GNUmakefile.bin 580483 2007-09-28 20:55:52Z sebor $ # # makefile to build the C++ Standard library utility programs # ######################################################################## # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed # with this work for additional information regarding copyright # ownership. The ASF licenses this file to you under the Apache # License, Version 2.0 (the "License"); you may not use this file # except in compliance with the License. You may obtain a copy of # the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. # # Copyright 1999-2007 Rogue Wave Software, Inc. # ######################################################################## include ../makefile.in SRCDIRS = $(TOPDIR)/util # include common variables setting for all makefiles ONE_REPOSITORY = 1 include ../makefile.common TARGET = exec localedef locale gencat # locale sources and related NLSDIR = $(TOPDIR)/etc/nls LOCDIR = $(BUILDDIR)/nls # add nls directory to VPATH so that the database directories do not # have to carry the path with them in the rule target. VPATH += $(LOCDIR) # list of locales to build # first compose a full name from gen_list in the form # . # then move the known modifiers (@euro and @cyrillic) to the end # of the name LOCALES := \ $(shell sed -e s:"^ *\([^ ]*\) *\([^ ]*\) *":"\1\.\2":g \ -e s:"\([^.]*\)\(.euro\)\([^ ]*\)":"\1\3@euro":g \ -e s:"\([^.]*\)\(.cyrillic\)\([^ ]*\)":"\1\3@cyrillic":g \ $(NLSDIR)/gen_list) ## Filter from RUNTARGET only the scripts RUNTARGET := $(filter %.sh,$(RUNTARGET)) # If empty populate it with the names of the locales databases test scripts ifeq ($(RUNTARGET),) RUNTARGET := sanity_test.sh $(patsubst %,%.sh,$(LOCALES)) endif ifneq ($(CXX_REPOSITORY),) LDFLAGS += $(CPPFLAGS) endif # ($(CXX_REPOSITORY),) # Don't want to link exec utility with stdlib, so create our own LDFLAGS var LDFLAGS.exec = $(filter-out -l$(LIBBASE),$(LDFLAGS)) ifneq ($(RPATH),) LDFLAGS += $(RPATH)$(LIBDIR) endif ######################################################################## # TARGETS ######################################################################## all: $(LIBDIR)/$(LIBNAME) $(TARGET) $(RUNTARGET) $(LIBDIR)/$(LIBNAME): @$(MAKE) -C $(LIBDIR) # link the run utility exec: runall.o cmdopt.o output.o util.o exec.o display.o @echo "$(LD) $^ -o $@ $(LDFLAGS.exec) $(LDLIBS)" $(call CXX.repo,$<) \ >> $(LOGFILE) $(LD) $^ -o $@ $(LDFLAGS.exec) $(LDLIBS) $(call CXX.repo,$<) $(TEEOPTS) # link the localedef utility localedef: localedef.o locale.o aliases.o charmap.o codecvt.o collate.o \ ctype.o def.o diagnostic.o memchk.o messages.o monetary.o \ numeric.o path.o time.o scanner.o @echo "$(LD) $^ -o $@ $(LDFLAGS) $(LDLIBS)" $(call CXX.repo,$<) \ >> $(LOGFILE) $(LD) $^ -o $@ $(LDFLAGS) $(LDLIBS) $(call CXX.repo,$<) $(TEEOPTS) # link the locale utility locale: locale_stub.o @echo "$(LD) $^ -o $@ $(LDFLAGS) $(LDLIBS)" $(call CXX.repo,$<) \ >> $(LOGFILE) $(LD) $^ -o $@ $(LDFLAGS) $(LDLIBS) $(call CXX.repo,$<) $(TEEOPTS) # link the gencat utility gencat: gencat.o @echo "$(LD) $^ -o $@ $(LDFLAGS) $(LDLIBS)" $(call CXX.repo,$<) \ >> $(LOGFILE) $(LD) $^ -o $@ $(LDFLAGS) $(LDLIBS) $(call CXX.repo,$<) $(TEEOPTS) # build all locales with the localedef utility locales: localedef $(LOCALES) # the rule builds the scripts that are run by the runall script $(RUNTARGET): $(NLSDIR)/gen_list @(echo "making $@..."; \ echo "#!/bin/sh" > $@; \ locname=`echo $@ | sed "s:^\./::g;s:\.sh$$::g"`; \ if [ "$@" = "sanity_test.sh" ]; then \ echo "./run_utils -s -b $(BUILDDIR)/bin $$""*" >>$@; \ else \ echo "./run_utils -f -i $(NLSDIR) -l $$locname $$""*" >> $@; \ fi; \ chmod ug+x $@;) # the rule presents as dependencies the source files corresponding # to that locale; it is run once for each entry in LOCALES $(LOCALES): $(NLSDIR)/gen_list @(lname=`echo $@ | sed "s:\([^.]*\)\.\([^@]*\)\(.*\):\1\3:;y:@:.:"`; \ cname=`echo $@ | sed "s:\([^.]*\)\.\([^@]*\)\(.*\):\2:"`; \ echo "./localedef -w -c -f $(NLSDIR)/charmaps/$$cname" \ "-i $(NLSDIR)/src/$$lname $(LOCDIR)/$@"; \ ./localedef -w -c -f $(NLSDIR)/charmaps/$$cname \ -i $(NLSDIR)/src/$$lname $(LOCDIR)/$@) $(DEPENDDIR)/localedb.d: $(DEPENDDIR) $(NLSDIR)/gen_list @(echo "# generated locale dependencies" > $@; \ for f in ""$(LOCALES); do \ lname=`echo $$f | \ sed "s:\([^.]*\)\.\([^@]*\)\(.*\):\1\3:;y:@:.:"`; \ cname=`echo $$f | sed "s:\([^.]*\)\.\([^@]*\)\(.*\):\2:"`; \ f=$$f; \ echo "generating dependencies for $$f"; \ echo "$$f: $$""(NLSDIR)/src/$$lname" \ "$$""(NLSDIR)/charmaps/$$cname" >> $@; \ done;) # tell makefile.rules to include the generated dependencies file DEPS := $(DEPENDDIR)/localedb.d # do any directory specific cleanup using the realclean target realclean: clean dependclean -rm -rf $(TARGET) # compute the names of codesets (codecvt databases) and set # the variable only for the install target for efficiency install: codesets := \ $(sort $(shell echo $(LOCALES) \ | sed -e "s/[^ .@][^ .@]*\.\([^ ]*\)/\1/g" \ -e "s/@[^ ]*//g")) # create the $(PREFIX)/bin $(PREFIX)/nls directories and install # the utilities and locales install: locale localedef $(LOCALES) mkdir -p $(PREFIX)/bin cp locale localedef $(PREFIX)/bin mkdir -p $(PREFIX)/nls if [ "$(LOCALES)" != "" ]; then \ cd ../nls && cp -R $(LOCALES) $(codesets) $(PREFIX)/nls; \ fi include ../makefile.rules