1# -*- makefile -*-
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
5SHELL = /bin/sh
6MAKE = make
7AUTOCONF = autoconf-2.60
8AUTOHEADER = autoheader-2.60
9AUTOMAKE = automake-1.9
10ACLOCAL = aclocal-1.9
11GPERF = gperf
12CC = gcc
13CFLAGS = -O
14MAN2HTML = groff -mandoc -Thtml
15CP = cp
16RM = rm -f
17
18
19all : configures config.h.in srclib/Makefile.in config.h_vms config.h.msvc lib/config.h_vms lib/config.h.msvc include/iconv.h.build.in include/iconv.h_vms include/iconv.h.msvc-static include/iconv.h.msvc-shared lib/aliases.h lib/aliases_aix.h lib/aliases_osf1.h lib/aliases_dos.h lib/aliases_extra.h lib/flags.h lib/translit.h man/iconv.1.html man/iconv.3.html man/iconv_close.3.html man/iconv_open.3.html po/Makefile.msvc force
20	cd libcharset && $(MAKE) -f Makefile.devel all
21
22
23# Before making a new release:
24# - check that the encoding lists in README and man/iconv_open.3 are up to date,
25# - increment the version number in
26#     include/iconv.h.in
27#     README
28#     windows/iconv.rc
29#     djgpp/README
30#     djgpp/fnchange.lst
31#     libcharset/djgpp/README
32#     libcharset/djgpp/fnchange.lst
33# - update the version info in lib/Makefile.in,
34# - do "make -f Makefile.devel".
35
36
37CONFIGURES = configure
38CONFIGURES_IN = configure.ac
39
40#CLISP_DIR = ..
41#m4/general.m4 : $(CLISP_DIR)/src/m4/general.m4 ; cp -p $< $@-t && mv $@-t $@
42#m4/proto.m4 : $(CLISP_DIR)/src/m4/proto.m4 ; cp -p $< $@-t && mv $@-t $@
43#m4/cp.m4 : $(CLISP_DIR)/src/m4/cp.m4 ; cp -p $< $@-t && mv $@-t $@
44#m4/ln.m4 : $(CLISP_DIR)/src/m4/ln.m4 ; cp -p $< $@-t && mv $@-t $@
45#m4/endian.m4 : $(CLISP_DIR)/src/m4/endian.m4 ; cp -p $< $@-t && mv $@-t $@
46#m4/libtool.m4 : $(CLISP_DIR)/src/m4/libtool.m4 ; cp -p $< $@-t && mv $@-t $@
47
48aclocal.m4 : $(CONFIGURES_IN) m4/general.m4 m4/proto.m4 m4/cp.m4 m4/ln.m4 m4/codeset.m4 m4/eilseq.m4 m4/endian.m4 m4/glibc21.m4 m4/isc-posix.m4 m4/lcmessage.m4 m4/alloca.m4 m4/allocsa.m4 m4/canonicalize.m4 m4/eealloc.m4 m4/error.m4 m4/extensions.m4 m4/full-header-path.m4 m4/mbstate_t.m4 m4/onceonly.m4 m4/pathmax.m4 m4/readlink.m4 m4/relocatable.m4 m4/setenv.m4 m4/size_max.m4 m4/ssize_t.m4 m4/stdbool.m4 m4/stdint.m4 m4/strerror.m4 m4/strerror_r.m4 m4/unistd_h.m4 m4/unlocked-io.m4 m4/xreadlink.m4 m4/visibility.m4  m4/libtool.m4  m4/gettext.m4 m4/iconv.m4 m4/intmax.m4 m4/inttypes-h.m4 m4/inttypes_h.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/longdouble.m4 m4/longlong.m4 m4/nls.m4 m4/po.m4 m4/printf-posix.m4 m4/progtest.m4 m4/signed.m4 m4/stdint_h.m4 m4/wchar_t.m4 m4/wint_t.m4
49	$(ACLOCAL) -I m4 --output=$@
50
51configures : $(CONFIGURES)
52
53AUTOCONF_FILES = aclocal.m4
54
55configure : configure.ac $(AUTOCONF_FILES)
56	$(AUTOCONF)
57
58check-configures : $(CONFIGURES)
59	set -e; for f in $(CONFIGURES); do bash -x -n $$f; done
60
61config.h.in : configure.ac $(AUTOCONF_FILES)
62	$(AUTOHEADER)
63	touch $@
64
65
66srclib/Makefile.in : srclib/Makefile.am
67	$(AUTOMAKE) --gnits srclib/Makefile
68
69
70config.h_vms : config.h.in
71	sed -e 's/#undef ENABLE_NLS$$/#define ENABLE_NLS 1/' \
72	    -e 's/#undef ENABLE_RELOCATABLE$$/#define ENABLE_RELOCATABLE 1/' \
73	    -e 's/#undef HAVE_ALLOCA$$/#define HAVE_ALLOCA 1/' \
74	    -e 's/#undef HAVE_DECL_STRERROR$$/#define HAVE_DECL_STRERROR 1/' \
75	    -e 's/#undef HAVE_DLFCN_H$$/#define HAVE_DLFCN_H 1/' \
76	    -e 's/#undef HAVE_ERRNO_DECL$$/#define HAVE_ERRNO_DECL 1/' \
77	    -e 's/#undef HAVE_GETCWD$$/#define HAVE_GETCWD 1/' \
78	    -e 's/#undef HAVE_ICONV$$/#define HAVE_ICONV 1/' \
79	    -e 's/#undef HAVE_INTTYPES_H$$/#define HAVE_INTTYPES_H 1/' \
80	    -e 's/#undef HAVE_LANGINFO_CODESET$$/#define HAVE_LANGINFO_CODESET 1/' \
81	    -e 's/#undef HAVE_LIMITS_H$$/#define HAVE_LIMITS_H 1/' \
82	    -e 's/#undef HAVE_LOCALE_H$$/#define HAVE_LOCALE_H 1/' \
83	    -e 's/#undef HAVE_MBRTOWC$$/#define HAVE_MBRTOWC 1/' \
84	    -e 's/#undef HAVE_MBSINIT$$/#define HAVE_MBSINIT 1/' \
85	    -e 's/#undef HAVE_MEMMOVE$$/#define HAVE_MEMMOVE 1/' \
86	    -e 's/#undef HAVE_MEMORY_H$$/#define HAVE_MEMORY_H 1/' \
87	    -e 's/#undef HAVE_SETENV$$/#define HAVE_SETENV 1/' \
88	    -e 's/#undef HAVE_SETLOCALE$$/#define HAVE_SETLOCALE 1/' \
89	    -e 's/#undef HAVE_STDBOOL_H$$/#define HAVE_STDBOOL_H 1/' \
90	    -e 's/#undef HAVE_STDDEF_H$$/#define HAVE_STDDEF_H 1/' \
91	    -e 's/#undef HAVE_STDLIB_H$$/#define HAVE_STDLIB_H 1/' \
92	    -e 's/#undef HAVE_STRERROR$$/#define HAVE_STRERROR 1/' \
93	    -e 's/#undef HAVE_STRINGS_H$$/#define HAVE_STRINGS_H 1/' \
94	    -e 's/#undef HAVE_STRING_H$$/#define HAVE_STRING_H 1/' \
95	    -e 's/#undef HAVE_SYS_PARAM_H$$/#define HAVE_SYS_PARAM_H 1/' \
96	    -e 's/#undef HAVE_SYS_STAT_H$$/#define HAVE_SYS_STAT_H 1/' \
97	    -e 's/#undef HAVE_SYS_TYPES_H$$/#define HAVE_SYS_TYPES_H 1/' \
98	    -e 's/#undef HAVE_UNISTD_H$$/#define HAVE_UNISTD_H 1/' \
99	    -e 's/#undef HAVE_UNSETENV$$/#define HAVE_UNSETENV 1/' \
100	    -e 's/#undef HAVE_VPRINTF$$/#define HAVE_VPRINTF 1/' \
101	    -e 's/#undef HAVE_WCHAR_H$$/#define HAVE_WCHAR_H 1/' \
102	    -e 's/#undef HAVE_WCRTOMB$$/#define HAVE_WCRTOMB 1/' \
103	    -e 's/#undef ICONV_CONST$$/#define ICONV_CONST/' \
104	    -e 's/#undef MALLOC_0_IS_NONNULL$$/#define MALLOC_0_IS_NONNULL 0/' \
105	    -e 's/#undef STDC_HEADERS$$/#define STDC_HEADERS 1/' \
106	    -e 's/#undef WORDS_LITTLEENDIAN$$/#define WORDS_LITTLEENDIAN 1/' \
107	    -e 's/#undef realpath$$/#define realpath rpl_realpath/' \
108	    -e '/#undef INSTALLPREFIX$$/d' \
109	  < $< > $@
110
111config.h.msvc : config.h.in
112	sed -e 's/#undef ENABLE_RELOCATABLE$$/#define ENABLE_RELOCATABLE 1/' \
113	    -e 's/#undef HAVE_ALLOCA$$/#define HAVE_ALLOCA 1/' \
114	    -e 's/#undef HAVE_DECL_STRERROR$$/#define HAVE_DECL_STRERROR 1/' \
115	    -e 's/#undef HAVE_ENVIRON_DECL$$/#define HAVE_ENVIRON_DECL 1/' \
116	    -e 's/#undef HAVE_ERRNO_DECL$$/#define HAVE_ERRNO_DECL 1/' \
117	    -e 's/#undef HAVE_GETCWD$$/#define HAVE_GETCWD 1/' \
118	    -e 's/#undef HAVE_LIMITS_H$$/#define HAVE_LIMITS_H 1/' \
119	    -e 's/#undef HAVE_LOCALE_H$$/#define HAVE_LOCALE_H 1/' \
120	    -e 's/#undef HAVE_MEMMOVE$$/#define HAVE_MEMMOVE 1/' \
121	    -e 's/#undef HAVE_MEMORY_H$$/#define HAVE_MEMORY_H 1/' \
122	    -e 's/#undef HAVE_SEARCH_H$$/#define HAVE_SEARCH_H 1/' \
123	    -e 's/#undef HAVE_SETLOCALE$$/#define HAVE_SETLOCALE 1/' \
124	    -e 's/#undef HAVE_STDDEF_H$$/#define HAVE_STDDEF_H 1/' \
125	    -e 's/#undef HAVE_STDLIB_H$$/#define HAVE_STDLIB_H 1/' \
126	    -e 's/#undef HAVE_STRERROR$$/#define HAVE_STRERROR 1/' \
127	    -e 's/#undef HAVE_STRING_H$$/#define HAVE_STRING_H 1/' \
128	    -e 's/#undef HAVE_SYS_STAT_H$$/#define HAVE_SYS_STAT_H 1/' \
129	    -e 's/#undef HAVE_SYS_TYPES_H$$/#define HAVE_SYS_TYPES_H 1/' \
130	    -e 's/#undef HAVE_VPRINTF$$/#define HAVE_VPRINTF 1/' \
131	    -e 's/#undef MALLOC_0_IS_NONNULL$$/#define MALLOC_0_IS_NONNULL 1/' \
132	    -e 's/#undef STACK_DIRECTION$$/#define STACK_DIRECTION -1/' \
133	    -e 's/#undef STDC_HEADERS$$/#define STDC_HEADERS 1/' \
134	    -e 's/#undef WORDS_LITTLEENDIAN$$/#define WORDS_LITTLEENDIAN 1/' \
135	    -e '/#undef ENABLE_NLS$$/d' \
136	    -e '/#undef INSTALLPREFIX$$/d' \
137	  < $< > $@
138
139lib/config.h_vms : lib/config.h.in
140	sed -e 's/#undef ENABLE_RELOCATABLE$$/#define ENABLE_RELOCATABLE 1/' \
141	    -e 's/#undef HAVE_ICONV$$/#define HAVE_ICONV 1/' \
142	    -e 's/#define ICONV_CONST const$$/#define ICONV_CONST/' \
143	    -e 's/#undef HAVE_LANGINFO_CODESET$$/#define HAVE_LANGINFO_CODESET 1/' \
144	    -e 's/#undef HAVE_MBRTOWC$$/#define HAVE_MBRTOWC 1/' \
145	    -e 's/#undef HAVE_SETLOCALE$$/#define HAVE_SETLOCALE 1/' \
146	    -e 's/#undef HAVE_STDDEF_H$$/#define HAVE_STDDEF_H 1/' \
147	    -e 's/#undef HAVE_STDLIB_H$$/#define HAVE_STDLIB_H 1/' \
148	    -e 's/#undef HAVE_STRING_H$$/#define HAVE_STRING_H 1/' \
149	    -e 's/#undef HAVE_WCRTOMB$$/#define HAVE_WCRTOMB 1/' \
150	    -e 's/#undef WORDS_LITTLEENDIAN$$/#define WORDS_LITTLEENDIAN 1/' \
151	    -e '/#undef INSTALLPREFIX$$/d' \
152	  < $< > $@
153
154lib/config.h.msvc : lib/config.h.in
155	sed -e 's/#undef ENABLE_RELOCATABLE$$/#define ENABLE_RELOCATABLE 1/' \
156	    -e 's/#undef HAVE_SETLOCALE$$/#define HAVE_SETLOCALE 1/' \
157	    -e 's/#undef HAVE_STDDEF_H$$/#define HAVE_STDDEF_H 1/' \
158	    -e 's/#undef HAVE_STDLIB_H$$/#define HAVE_STDLIB_H 1/' \
159	    -e 's/#undef HAVE_STRING_H$$/#define HAVE_STRING_H 1/' \
160	    -e 's/#undef WORDS_LITTLEENDIAN$$/#define WORDS_LITTLEENDIAN 1/' \
161	    -e '/#undef INSTALLPREFIX$$/d' \
162	  < $< > $@
163
164include/iconv.h.build.in : include/iconv.h.in include/export.h
165	sed -e 's/extern \([^"]\)/extern LIBICONV_DLL_EXPORTED \1/' \
166	    -e '/_LIBICONV_VERSION/r include/export.h' \
167	  < $< > $@
168
169include/iconv.h_vms : include/iconv.h.in
170	sed -e 's/@ICONV_CONST@//g' -e 's/@HAVE_WCHAR_T@/1/g' \
171	    -e 's/ @DLL_VARIABLE@//g' \
172	  < $< > $@
173
174include/iconv.h.msvc-static : include/iconv.h.in
175	sed -e 's/@ICONV_CONST@/const/g' -e 's/@HAVE_WCHAR_T@/1/g' \
176	    -e 's/ @DLL_VARIABLE@//g' \
177	  < $< > $@
178
179include/iconv.h.msvc-shared : include/iconv.h.in windows/dllexport.h
180	sed -e 's/@ICONV_CONST@/const/g' -e 's/@HAVE_WCHAR_T@/1/g' \
181	    -e 's/ @DLL_VARIABLE@//g' \
182	    -e 's/extern \([^"]\)/extern LIBICONV_DLL_EXPORTED \1/' \
183	    -e '/_LIBICONV_VERSION/r windows/dllexport.h' \
184	  < $< > $@
185
186
187lib/aliases.h lib/canonical.h lib/canonical_local.h : lib/encodings.def lib/encodings_local.def lib/genaliases.c
188	$(CC) $(CFLAGS) lib/genaliases.c -o genaliases
189	./genaliases > lib/aliases.gperf 3> canonical.sh 4> canonical_local.sh
190	$(RM) genaliases
191	$(GPERF) -m 10 lib/aliases.gperf > tmp.h
192	$(CP) tmp.h lib/aliases.h
193	sh canonical.sh > lib/canonical.h
194	sh canonical_local.sh > lib/canonical_local.h
195	$(RM) tmp.h canonical.sh canonical_local.sh
196
197lib/aliases_aix.h lib/canonical_aix.h : lib/encodings_aix.def lib/genaliases2.c
198	$(CC) $(CFLAGS) -DUSE_AIX lib/genaliases2.c -o genaliases
199	./genaliases aix > lib/aliases_aix.h 3> lib/canonical_aix.h
200	$(RM) genaliases
201
202lib/aliases_osf1.h lib/canonical_osf1.h : lib/encodings_osf1.def lib/genaliases2.c
203	$(CC) $(CFLAGS) -DUSE_OSF1 lib/genaliases2.c -o genaliases
204	./genaliases osf1 > lib/aliases_osf1.h 3> lib/canonical_osf1.h
205	$(RM) genaliases
206
207lib/aliases_dos.h lib/canonical_dos.h : lib/encodings_dos.def lib/genaliases2.c
208	$(CC) $(CFLAGS) -DUSE_DOS lib/genaliases2.c -o genaliases
209	./genaliases dos > lib/aliases_dos.h 3> lib/canonical_dos.h
210	$(RM) genaliases
211
212lib/aliases_extra.h lib/canonical_extra.h : lib/encodings_extra.def lib/genaliases2.c
213	$(CC) $(CFLAGS) -DUSE_EXTRA lib/genaliases2.c -o genaliases
214	./genaliases extra > lib/aliases_extra.h 3> lib/canonical_extra.h
215	$(RM) genaliases
216
217
218lib/flags.h : lib/encodings.def lib/encodings_aix.def lib/encodings_osf1.def lib/encodings_dos.def lib/encodings_extra.def lib/converters.h lib/genflags.c
219	$(CC) $(CFLAGS) lib/genflags.c -o genflags
220	./genflags > lib/flags.h
221	$(RM) genflags
222
223
224lib/translit.h : lib/translit.def lib/gentranslit.c
225	$(CC) $(CFLAGS) lib/gentranslit.c -o gentranslit
226	ulimit -s unlimited; ./gentranslit < lib/translit.def > lib/translit.h
227	$(RM) gentranslit
228
229
230man/%.html : man/%
231	$(MAN2HTML) $< > $@
232
233
234po/Makefile.msvc : po/LINGUAS
235	ALL_LINGUAS=`sed -e '/^#/d' po/LINGUAS`; \
236	GMOFILES=; for lang in $$ALL_LINGUAS; do GMOFILES="$$GMOFILES $$lang.gmo"; done; \
237	$(SHELL) po/Makefile.msvc.sh libiconv "$$GMOFILES" > po/Makefile.msvc
238
239
240force :
241