1169695Skan# @configure_input@
2169695Skan# Makefile for libcpp.  Run 'configure' to generate Makefile from Makefile.in
3169695Skan
4169695Skan# Copyright (C) 2004 Free Software Foundation, Inc.
5169695Skan
6169695Skan#This file is part of libcpp.
7169695Skan
8169695Skan#libcpp is free software; you can redistribute it and/or modify
9169695Skan#it under the terms of the GNU General Public License as published by
10169695Skan#the Free Software Foundation; either version 2, or (at your option)
11169695Skan#any later version.
12169695Skan
13169695Skan#libcpp is distributed in the hope that it will be useful,
14169695Skan#but WITHOUT ANY WARRANTY; without even the implied warranty of
15169695Skan#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16169695Skan#GNU General Public License for more details.
17169695Skan
18169695Skan#You should have received a copy of the GNU General Public License
19169695Skan#along with libcpp; see the file COPYING.  If not, write to
20169695Skan#the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21169695Skan#Boston MA 02110-1301, USA.
22169695Skan
23169695Skan@SET_MAKE@
24169695Skan
25169695Skansrcdir = @srcdir@
26169695Skantop_builddir = .
27169695SkanVPATH = @srcdir@
28169695SkanINSTALL = @INSTALL@
29243933SeadlerAR = @AR@
30243933SeadlerARFLAGS = @ARFLAGS@
31169695SkanACLOCAL = @ACLOCAL@
32169695SkanAUTOCONF = @AUTOCONF@
33169695SkanAUTOHEADER = @AUTOHEADER@
34169695SkanCATALOGS = $(patsubst %,po/%,@CATALOGS@)
35169695SkanCC = @CC@
36169695SkanCFLAGS = @CFLAGS@
37169695SkanWARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@
38169695SkanCPP = @CPP@
39169695SkanCPPFLAGS = @CPPFLAGS@
40169695SkanEXEEXT = @EXEEXT@
41169695SkanGMSGFMT = @GMSGFMT@
42169695SkanINCINTL = @INCINTL@
43169695SkanINSTALL_DATA = @INSTALL_DATA@
44169695SkanINSTALL_PROGRAM = @INSTALL_PROGRAM@
45169695SkanINSTALL_SCRIPT = @INSTALL_SCRIPT@
46169695SkanLDFLAGS = @LDFLAGS@
47169695SkanLIBICONV = @LIBICONV@
48169695SkanLIBINTL = @LIBINTL@
49169695SkanPACKAGE = @PACKAGE@
50169695SkanRANLIB = @RANLIB@
51169695SkanSHELL = @SHELL@
52169695SkanUSED_CATALOGS = @USED_CATALOGS@
53169695SkanXGETTEXT = @XGETTEXT@
54169695SkanDEPMODE = @CCDEPMODE@
55169695SkanDEPDIR = @DEPDIR@
56169695Skan
57169695Skandatadir = @datadir@
58169695Skanexec_prefix = @prefix@
59169695Skanlibdir = @libdir@
60169695Skanlocaledir = $(datadir)/locale
61169695Skanprefix = @prefix@
62169695Skan
63169695SkanMSGMERGE = msgmerge
64169695Skanmkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
65169695Skandepcomp = $(SHELL) $(srcdir)/../depcomp
66169695Skan
67169695SkanINCLUDES = -I$(srcdir) -I. -I$(srcdir)/../include @INCINTL@ \
68169695Skan	-I$(srcdir)/include
69169695Skan
70169695SkanALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS)
71169695Skan
72259405Spfglibcpp_a_OBJS = charset.o directives.o directives-only.o errors.o \
73259405Spfg	expr.o files.o identifiers.o init.o lex.o line-map.o macro.o \
74259405Spfg	mkdeps.o pch.o symtab.o traditional.o
75169695Skanmakedepend_OBJS = makedepend.o
76169695Skan
77259405Spfglibcpp_a_SOURCES = charset.c directives.c directives-only.c errors.c \
78259405Spfg	expr.c files.c identifiers.c init.c lex.c line-map.c macro.c \
79259405Spfg	mkdeps.c pch.c symtab.c traditional.c
80169695Skan
81169695Skanall: libcpp.a makedepend$(EXEEXT) $(USED_CATALOGS)
82169695Skan
83169695Skan.SUFFIXES:
84169695Skan.SUFFIXES: .c .gmo .o .obj .po .pox
85169695Skan
86169695Skanlibcpp.a: $(libcpp_a_OBJS)
87169695Skan	-rm -f libcpp.a
88169695Skan	$(AR) $(ARFLAGS) libcpp.a $(libcpp_a_OBJS)
89169695Skan	$(RANLIB) libcpp.a
90169695Skan
91169695Skanmakedepend$(EXEEXT): $(makedepend_OBJS) libcpp.a ../libiberty/libiberty.a
92169695Skan	@rm -f makedepend$(EXEEXT)
93169695Skan	$(CC) $(CFLAGS) $(LDFLAGS) -o makedepend$(EXEEXT) \
94169695Skan	  $(makedepend_OBJS) libcpp.a ../libiberty/libiberty.a \
95169695Skan	  $(LIBINTL) $(LIBICONV)
96169695Skan
97169695Skan# Rules to rebuild the configuration
98169695Skan
99169695SkanMakefile: $(srcdir)/Makefile.in config.status
100169695Skan	$(SHELL) ./config.status Makefile
101169695Skan
102169695Skanconfig.status: $(srcdir)/configure
103169695Skan	$(SHELL) ./config.status --recheck
104169695Skan
105169695Skan$(srcdir)/configure: @MAINT@ $(srcdir)/aclocal.m4
106169695Skan	cd $(srcdir) && $(AUTOCONF)
107169695Skan
108169695Skan$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/../config/acx.m4 \
109169695Skan	$(srcdir)/../config/gettext-sister.m4 $(srcdir)/../config/iconv.m4 \
110169695Skan	$(srcdir)/../config/codeset.m4 $(srcdir)/../config/lib-ld.m4 \
111169695Skan	$(srcdir)/../config/lib-link.m4 $(srcdir)/../config/lib-prefix.m4 \
112169695Skan	$(srcdir)/configure.ac
113169695Skan	cd $(srcdir) && $(ACLOCAL) -I ../config
114169695Skan
115169695Skanconfig.h: stamp-h1
116169695Skan	test -f config.h || (rm -f stamp-h1 && $(MAKE) stamp-h1)
117169695Skan
118169695Skanstamp-h1: $(srcdir)/config.in config.status
119169695Skan	-rm -f stamp-h1
120169695Skan	$(SHELL) ./config.status config.h
121169695Skan
122169695Skan$(srcdir)/config.in: @MAINT@ $(srcdir)/configure
123169695Skan	cd $(srcdir) && $(AUTOHEADER)
124169695Skan	-rm -f stamp-h1
125169695Skan
126169695Skan# It is not possible to get LOCALEDIR defined in config.h because
127169695Skan# the value it needs to be defined to is only determined in the
128169695Skan# Makefile.  Hence we do this instead.
129169695Skanlocaledir.h: localedir.hs; @true
130169695Skanlocaledir.hs: Makefile
131169695Skan	echo "#define LOCALEDIR \"$(localedir)\"" > localedir.new
132169695Skan	$(srcdir)/../move-if-change localedir.new localedir.h
133169695Skan	echo timestamp > localedir.hs
134169695Skan
135169695Skan# Installation rules and other phony targets
136169695Skan
137169695Skan# These rule has to look for .gmo modules in both srcdir and
138169695Skan# the cwd, and has to check that we actually have a catalog
139169695Skan# for each language, in case they weren't built or included
140169695Skan# with the distribution.
141169695Skaninstalldirs:
142169695Skan	@$(mkinstalldirs) $(DESTDIR)$(datadir); \
143169695Skan	cats="$(CATALOGS)"; for cat in $$cats; do \
144169695Skan	  lang=`basename $$cat | sed 's/\.gmo$$//'`; \
145169695Skan	  if [ -f $$cat ] || [ -f $(srcdir)/$$cat ]; then \
146169695Skan	    dir=$(localedir)/$$lang/LC_MESSAGES; \
147169695Skan	    $(mkinstalldirs) $(DESTDIR)$$dir || exit 1; \
148169695Skan	  fi; \
149169695Skan	done
150169695Skan
151169695Skaninstall-strip install: all installdirs
152169695Skan	cats="$(CATALOGS)"; for cat in $$cats; do \
153169695Skan	  lang=`basename $$cat | sed 's/\.gmo$$//'`; \
154169695Skan	  if [ -f $$cat ]; then :; \
155169695Skan	  elif [ -f $(srcdir)/$$cat ]; then cat=$(srcdir)/$$cat; \
156169695Skan	  else continue; \
157169695Skan	  fi; \
158169695Skan	  dir=$(localedir)/$$lang/LC_MESSAGES; \
159169695Skan	  echo $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
160169695Skan	  $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
161169695Skan	done
162169695Skan
163169695Skanmostlyclean:
164169695Skan	-rm -f *.o
165169695Skan
166169695Skanclean: mostlyclean
167169695Skan	-rm -rf makedepend$(EXEEXT) libcpp.a $(srcdir)/autom4te.cache
168169695Skan
169169695Skandistclean: clean
170169695Skan	-rm -f config.h stamp-h1 config.status config.cache config.log \
171169695Skan	  configure.lineno configure.status.lineno Makefile localedir.h \
172169695Skan	  localedir.hs $(DEPDIR)/*.Po
173169695Skan	-rmdir $(DEPDIR)
174169695Skan
175169695Skanmaintainer-clean: distclean
176169695Skan	@echo "This command is intended for maintainers to use"
177169695Skan	@echo "it deletes files that may require special tools to rebuild."
178169695Skan	-rm -f $(srcdir)/configure $(srcdir)/aclocal.m4
179169695Skan
180169695Skancheck:
181169695Skaninstallcheck:
182169695Skandvi:
183169695Skanpdf:
184169695Skanhtml:
185169695Skaninfo:
186169695Skaninstall-info:
187169695Skaninstall-man:
188169695Skaninstall-html:
189169695Skan
190169695Skanupdate-po: $(CATALOGS:.gmo=.pox)
191169695Skan
192169695Skan.PHONY: installdirs install install-strip mostlyclean clean distclean \
193169695Skan  maintainer-clean check installcheck dvi pdf html info install-info \
194169695Skan  install-man update-po install-html
195169695Skan
196169695Skan# Dependency rule.
197169695SkanCOMPILE.base = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(ALL_CFLAGS) -c
198169695Skanifeq ($(DEPMODE),depmode=gcc3)
199169695SkanCOMPILE = $(COMPILE.base) -o $@ -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Po
200169695Skanelse
201169695SkanCOMPILE = source='$<' object='$@' libtool=no DEPDIR=$(DEPDIR) $(DEPMODE) \
202169695Skan	  $(depcomp) $(COMPILE.base)
203169695Skanendif
204169695Skan
205169695Skan# Implicit rules and I18N
206169695Skan
207169695Skan.c.o:
208169695Skan	$(COMPILE) $<
209169695Skan
210169695Skan# N.B. We do not attempt to copy these into $(srcdir).
211169695Skan.po.gmo:
212169695Skan	-test -d po || mkdir po
213169695Skan	$(GMSGFMT) --statistics -o $@ $<
214169695Skan
215169695Skan# The new .po has to be gone over by hand, so we deposit it into
216169695Skan# build/po with a different extension.
217169695Skan# If build/po/$(PACKAGE).pot exists, use it (it was just created),
218169695Skan# else use the one in srcdir.
219169695Skan.po.pox:
220169695Skan	-test -d po || mkdir po
221169695Skan	$(MSGMERGE) $< `if test -f po/$(PACKAGE).pot; \
222169695Skan	                then echo po/$(PACKAGE).pot; \
223169695Skan	                else echo $(srcdir)/po/$(PACKAGE).pot; fi` -o $@
224169695Skan
225169695Skan# Rule for regenerating the message template.
226169695Skan$(PACKAGE).pot: po/$(PACKAGE).pot
227169695Skanpo/$(PACKAGE).pot: $(libcpp_a_SOURCES)
228169695Skan	-test -d $(srcdir)/po || mkdir $(srcdir)/po
229169695Skan	$(XGETTEXT) --default-domain=$(PACKAGE) \
230169695Skan	  --keyword=_ --keyword=N_ \
231169695Skan	  --keyword=cpp_error:3 --keyword=cpp_errno:3 \
232169695Skan	  --keyword=cpp_error_with_line:5 \
233169695Skan	  --keyword=SYNTAX_ERROR --keyword=SYNTAX_ERROR2 \
234169695Skan	  --copyright-holder="Free Software Foundation, Inc." \
235169695Skan	  --msgid-bugs-address="http://gcc.gnu.org/bugs.html" \
236169695Skan	  --language=c -o po/$(PACKAGE).pot.tmp $^
237169695Skan	sed 's:$(srcdir)/::g' <po/$(PACKAGE).pot.tmp >po/$(PACKAGE).pot
238169695Skan	rm po/$(PACKAGE).pot.tmp
239169695Skan
240169695Skan
241169695Skan# Tell versions [3.59,3.63) of GNU make to not export all variables.
242169695Skan# Otherwise a system limit (for SysV at least) may be exceeded.
243169695Skan.NOEXPORT:
244169695Skan
245169695Skan# Dependencies
246169695Skan-include $(patsubst %.o, $(DEPDIR)/%.Po, $(libcpp_a_OBJS) $(makedepend_OBJS))
247169695Skan
248169695Skan# Dependencies on generated headers have to be explicit.
249169695Skaninit.o: localedir.h
250