2 # This is the developer's makefile, not the user's makefile.
3 # Don't use it unless you know exactly what you do!
4 # It requires GNU make.
5 # It obeys the environment variables GNULIB_TOOL, CC, CFLAGS
6 # if you have set them.
9 This makefile requires GNU Make.
15 AUTOHEADER = autoheader
16 AUTOMAKE = automake-1.17
17 ACLOCAL = aclocal-1.17
20 # Ignore the built-in default for CC. Also ignore $(CC) if it is empty.
21 # https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
22 # https://www.gnu.org/software/make/manual/html_node/Origin-Function.html
23 # https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#index-findstring
24 # https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#index-stripping-whitespace
25 # https://www.gnu.org/software/make/manual/html_node/Conditional-Functions.html#index-or
26 # https://www.gnu.org/software/make/manual/html_node/Override-Directive.html
27 ifneq ($(or $(findstring $(origin CC), undefined default),$(if $(strip $(CC)),,empty)),)
28 override CC = gcc -Wall
31 # Ignore the built-in default for CFLAGS.
32 # https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
33 # https://www.gnu.org/software/make/manual/html_node/Origin-Function.html
34 # https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#index-findstring
35 ifneq ($(findstring $(origin CFLAGS), undefined default),)
39 MAN2HTML = groff -mandoc -Thtml
44 all : srclib/Makefile.in \
45 configures config.h.in \
46 include/iconv.h.build.in \
47 lib/aliases.h lib/aliases_sysaix.h lib/aliases_syshpux.h lib/aliases_sysosf1.h lib/aliases_syssolaris.h \
48 lib/aliases_aix.h lib/aliases_aix_sysaix.h \
49 lib/aliases_osf1.h lib/aliases_osf1_sysosf1.h \
53 lib/flags.h lib/translit.h \
54 man/iconv.1.html man/iconv.3.html man/iconv_close.3.html man/iconv_open.3.html man/iconvctl.3.html man/iconv_open_into.3.html \
56 cd libcharset && $(MAKE) -f Makefile.devel all
59 # Before making a new release:
60 # - check that the encoding lists in README and man/iconv_open.3 are up to date,
61 # - check that the files in libcharset/lib/ are in sync with the gnulib module
63 # - increment the version number in
67 # - update the version info in lib/Makefile.in,
69 # Making a new release:
70 # - $ ./configure CPPFLAGS=-Wall; make; make check
80 lib-symbol-visibility \
95 srclib/Makefile.gnulib :
96 if test -n "$$GNULIB_TOOL"; then \
97 $$GNULIB_TOOL --copy-file m4/codeset.m4 srcm4/codeset.m4 || exit $$?; \
98 $$GNULIB_TOOL --lib=libicrt --source-base=srclib --m4-base=srcm4 --makefile-name=Makefile.gnulib --no-libtool --local-dir=gnulib-local --no-vc-files \
99 --import $(GNULIB_MODULES); \
102 gnulib-imported-files : force
103 if test -n "$$GNULIB_TOOL"; then \
104 for file in config.guess config.sub; do \
105 $$GNULIB_TOOL --copy-file build-aux/$$file || exit $$?; \
106 chmod a+x build-aux/$$file || exit $$?; \
108 $$GNULIB_TOOL --copy-file tests/qemu.h || exit $$?; \
111 srclib/Makefile.in : srclib/Makefile.am srclib/Makefile.gnulib aclocal.m4
112 # Make sure we get new versions of files brought in by automake.
113 (cd build-aux && rm -f depcomp install-sh mdate-sh missing test-driver)
114 $(AUTOMAKE) --gnits --add-missing --copy srclib/Makefile && rm -rf autom4te.cache
117 CONFIGURES = configure
118 CONFIGURES_IN = configure.ac
120 aclocal.m4 : $(CONFIGURES_IN) srclib/Makefile.gnulib $(wildcard m4/*.m4) $(wildcard srcm4/*.m4)
121 $(ACLOCAL) -I m4 -I srcm4 --output=$@ && touch $@ && rm -rf autom4te.cache
123 configures : $(CONFIGURES)
125 AUTOCONF_FILES = aclocal.m4 $(wildcard m4/*.m4) $(wildcard srcm4/*.m4)
127 configure : configure.ac $(AUTOCONF_FILES)
128 $(AUTOCONF) && rm -rf autom4te.cache
130 check-configures : $(CONFIGURES)
131 set -e; for f in $(CONFIGURES); do bash -x -n $$f; done
133 config.h.in : configure.ac $(AUTOCONF_FILES)
134 $(AUTOHEADER) && rm -rf autom4te.cache
138 include/iconv.h.build.in : include/iconv.h.in include/export.h
140 | sed -e 's/extern \([^"]\)/extern LIBICONV_SHLIB_EXPORTED \1/' \
141 -e '/_LIBICONV_VERSION/r include/export.h' \
142 | sed -e '/_LIBICONV_VERSION/,/[*][/]$$/{/_LIBICONV_VERSION/!d;}' > $@
145 lib/aliases.h lib/canonical.h lib/canonical_local.h : lib/encodings.def lib/encodings_local.def lib/genaliases.c
146 $(CC) $(CFLAGS) lib/genaliases.c -o genaliases
147 ./genaliases lib/aliases.gperf canonical.sh canonical_local.sh
149 $(GPERF) -m 10 lib/aliases.gperf > tmp.h
150 sed -e 's/^\(const struct alias \)/static \1/' < tmp.h > lib/aliases.h
151 sh canonical.sh > lib/canonical.h
152 sh canonical_local.sh > lib/canonical_local.h
153 $(RM) tmp.h canonical.sh canonical_local.sh
155 lib/aliases_sysaix.h lib/canonical_sysaix.h lib/canonical_local_sysaix.h : lib/encodings.def lib/encodings_local.def lib/genaliases.c
156 $(CC) $(CFLAGS) -DUSE_AIX_ALIASES lib/genaliases.c -o genaliases
157 ./genaliases lib/aliases_sysaix.gperf canonical.sh canonical_local.sh
159 $(GPERF) -m 10 lib/aliases_sysaix.gperf > tmp.h
160 sed -e 's/^\(const struct alias \)/static \1/' < tmp.h > lib/aliases_sysaix.h
161 sh canonical.sh > lib/canonical_sysaix.h
162 sh canonical_local.sh > lib/canonical_local_sysaix.h
163 $(RM) tmp.h canonical.sh canonical_local.sh
165 lib/aliases_syshpux.h lib/canonical_syshpux.h lib/canonical_local_syshpux.h : lib/encodings.def lib/encodings_local.def lib/genaliases.c
166 $(CC) $(CFLAGS) -DUSE_HPUX_ALIASES lib/genaliases.c -o genaliases
167 ./genaliases lib/aliases_syshpux.gperf canonical.sh canonical_local.sh
169 $(GPERF) -m 10 lib/aliases_syshpux.gperf > tmp.h
170 sed -e 's/^\(const struct alias \)/static \1/' < tmp.h > lib/aliases_syshpux.h
171 sh canonical.sh > lib/canonical_syshpux.h
172 sh canonical_local.sh > lib/canonical_local_syshpux.h
173 $(RM) tmp.h canonical.sh canonical_local.sh
175 lib/aliases_sysosf1.h lib/canonical_sysosf1.h lib/canonical_local_sysosf1.h : lib/encodings.def lib/encodings_local.def lib/genaliases.c
176 $(CC) $(CFLAGS) -DUSE_OSF1_ALIASES lib/genaliases.c -o genaliases
177 ./genaliases lib/aliases_sysosf1.gperf canonical.sh canonical_local.sh
179 $(GPERF) -m 10 lib/aliases_sysosf1.gperf > tmp.h
180 sed -e 's/^\(const struct alias \)/static \1/' < tmp.h > lib/aliases_sysosf1.h
181 sh canonical.sh > lib/canonical_sysosf1.h
182 sh canonical_local.sh > lib/canonical_local_sysosf1.h
183 $(RM) tmp.h canonical.sh canonical_local.sh
185 lib/aliases_syssolaris.h lib/canonical_syssolaris.h lib/canonical_local_syssolaris.h : lib/encodings.def lib/encodings_local.def lib/genaliases.c
186 $(CC) $(CFLAGS) -DUSE_SOLARIS_ALIASES lib/genaliases.c -o genaliases
187 ./genaliases lib/aliases_syssolaris.gperf canonical.sh canonical_local.sh
189 $(GPERF) -m 10 lib/aliases_syssolaris.gperf > tmp.h
190 sed -e 's/^\(const struct alias \)/static \1/' < tmp.h > lib/aliases_syssolaris.h
191 sh canonical.sh > lib/canonical_syssolaris.h
192 sh canonical_local.sh > lib/canonical_local_syssolaris.h
193 $(RM) tmp.h canonical.sh canonical_local.sh
195 lib/aliases_aix.h lib/canonical_aix.h : lib/encodings_aix.def lib/genaliases2.c
196 $(CC) $(CFLAGS) -DUSE_AIX lib/genaliases2.c -o genaliases
197 ./genaliases aix lib/aliases_aix.h lib/canonical_aix.h
200 lib/aliases_aix_sysaix.h lib/canonical_aix_sysaix.h : lib/encodings_aix.def lib/genaliases2.c
201 $(CC) $(CFLAGS) -DUSE_AIX -DUSE_AIX_ALIASES lib/genaliases2.c -o genaliases
202 ./genaliases aix lib/aliases_aix_sysaix.h lib/canonical_aix_sysaix.h
205 lib/aliases_osf1.h lib/canonical_osf1.h : lib/encodings_osf1.def lib/genaliases2.c
206 $(CC) $(CFLAGS) -DUSE_OSF1 lib/genaliases2.c -o genaliases
207 ./genaliases osf1 lib/aliases_osf1.h lib/canonical_osf1.h
210 lib/aliases_osf1_sysosf1.h lib/canonical_osf1_sysosf1.h : lib/encodings_osf1.def lib/genaliases2.c
211 $(CC) $(CFLAGS) -DUSE_OSF1 -DUSE_OSF1_ALIASES lib/genaliases2.c -o genaliases
212 ./genaliases osf1 lib/aliases_osf1_sysosf1.h lib/canonical_osf1_sysosf1.h
215 lib/aliases_dos.h lib/canonical_dos.h : lib/encodings_dos.def lib/genaliases2.c
216 $(CC) $(CFLAGS) -DUSE_DOS lib/genaliases2.c -o genaliases
217 ./genaliases dos lib/aliases_dos.h lib/canonical_dos.h
220 lib/aliases_zos.h lib/canonical_zos.h : lib/encodings_zos.def lib/genaliases2.c
221 $(CC) $(CFLAGS) -DUSE_ZOS lib/genaliases2.c -o genaliases
222 ./genaliases zos lib/aliases_zos.h lib/canonical_zos.h
225 lib/aliases_extra.h lib/canonical_extra.h : lib/encodings_extra.def lib/genaliases2.c
226 $(CC) $(CFLAGS) -DUSE_EXTRA lib/genaliases2.c -o genaliases
227 ./genaliases extra lib/aliases_extra.h lib/canonical_extra.h
231 lib/flags.h : lib/encodings.def lib/encodings_aix.def lib/encodings_osf1.def lib/encodings_dos.def lib/encodings_zos.def lib/encodings_extra.def lib/converters.h lib/genflags.c
232 $(CC) $(CFLAGS) lib/genflags.c -o genflags
233 ./genflags > lib/flags.h
237 lib/translit.h : lib/translit.def lib/gentranslit.c
238 $(CC) $(CFLAGS) lib/gentranslit.c -o gentranslit
239 ./gentranslit < lib/translit.def > lib/translit.h
244 $(MAN2HTML) $< > $@-t
245 grep -v '<!-- CreationDate' < $@-t > $@
250 # Move srclib/Makefile.gnulib away, so that the target 'srclib/Makefile.gnulib' will actually do something.
251 if test -f srclib/Makefile.gnulib; then \
252 mv srclib/Makefile.gnulib srclib/Makefile.gnulib~; \
254 # No need to remove the stale files. gnulib-tool does this itself, thanks to srcm4/gnulib-comp.m4.
255 # find srclib '(' -name '*.h' -o -name '*.c' -o -name '*.valgrind' ')' -exec rm -f '{}' ';'
258 totally-clean : force
259 rm -f srclib/Makefile.in
260 rm -f aclocal.m4 $(CONFIGURES) config.h.in include/iconv.h.build.in
261 rm -f lib/aliases.gperf lib/aliases_sysaix.gperf lib/aliases_syshpux.gperf lib/aliases_sysosf1.gperf lib/aliases_syssolaris.gperf
262 rm -f lib/aliases.h lib/aliases_sysaix.h lib/aliases_syshpux.h lib/aliases_sysosf1.h lib/aliases_syssolaris.h
263 rm -f lib/aliases_aix.h lib/aliases_aix_sysaix.h
264 rm -f lib/aliases_osf1.h lib/aliases_osf1_sysosf1.h
265 rm -f lib/aliases_dos.h
266 rm -f lib/aliases_zos.h
267 rm -f lib/aliases_extra.h
268 rm -f lib/canonical.h lib/canonical_sysaix.h lib/canonical_syshpux.h lib/canonical_sysosf1.h lib/canonical_syssolaris.h
269 rm -f lib/canonical_aix.h lib/canonical_aix_sysaix.h
270 rm -f lib/canonical_osf1.h lib/canonical_osf1_sysosf1.h
271 rm -f lib/canonical_dos.h
272 rm -f lib/canonical_zos.h
273 rm -f lib/canonical_extra.h
274 rm -f lib/canonical_local.h lib/canonical_local_sysaix.h lib/canonical_local_syshpux.h lib/canonical_local_sysosf1.h lib/canonical_local_syssolaris.h
277 rm -f man/iconv.1.html man/iconv.3.html man/iconv_close.3.html man/iconv_open.3.html man/iconvctl.3.html man/iconv_open_into.3.html
278 cd libcharset && $(MAKE) -f Makefile.devel totally-clean