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.52
8GPERF = gperf
9CC = gcc
10CFLAGS = -O
11MAN2HTML = groff -mandoc -Thtml
12CP = cp
13RM = rm -f
14
15
16all : configures lib/config.h.msvc 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 force
17	cd libcharset && $(MAKE) -f Makefile.devel all
18
19
20# Before making a new release:
21# - check that the encoding lists in README and man/iconv_open.3 are up to date,
22# - increment the version number in
23#     include/iconv.h.in
24#     README
25#     windows/iconv.rc
26#     djgpp/README
27#     djgpp/fnchange.lst
28#     libcharset/djgpp/README
29#     libcharset/djgpp/fnchange.lst
30# - update the version info in lib/Makefile.in,
31# - do "make -f Makefile.devel".
32
33
34CONFIGURES = configure
35CONFIGURES_IN = configure.in
36
37CLISP_DIR = ..
38
39#m4/general.m4 : $(CLISP_DIR)/src/m4/general.m4 ; cp -p $< $@-t && mv $@-t $@
40#m4/proto.m4 : $(CLISP_DIR)/src/m4/proto.m4 ; cp -p $< $@-t && mv $@-t $@
41#m4/ranlib.m4 : $(CLISP_DIR)/src/m4/ranlib.m4 ; cp -p $< $@-t && mv $@-t $@
42#m4/cp.m4 : $(CLISP_DIR)/src/m4/cp.m4 ; cp -p $< $@-t && mv $@-t $@
43#m4/ln.m4 : $(CLISP_DIR)/src/m4/ln.m4 ; cp -p $< $@-t && mv $@-t $@
44#m4/endian.m4 : $(CLISP_DIR)/src/m4/endian.m4 ; cp -p $< $@-t && mv $@-t $@
45#m4/libtool.m4 : $(CLISP_DIR)/src/m4/libtool.m4
46#	sed -e 's,AC_CANONICAL_HOST,CL_CANONICAL_HOST,g' -e 's,AC_PROG_RANLIB,CL_PROG_RANLIB,g' -e 's,AC_PROG_LN_S,CL_PROG_LN_S,g' < $< > $@-t && mv $@-t $@
47
48autoconf/aclocal.m4 : m4/general.m4 m4/proto.m4 m4/ranlib.m4 m4/cp.m4 m4/ln.m4 m4/endian.m4 m4/libtool.m4
49	aclocal --acdir=m4 --output=$@
50
51configures : $(CONFIGURES)
52
53AUTOCONF_FILES = autoconf/aclocal.m4
54
55configure : configure.in $(AUTOCONF_FILES)
56	$(AUTOCONF) -l autoconf
57
58check-configures : $(CONFIGURES)
59	set -e; for f in $(CONFIGURES); do bash -x -n $$f; done
60
61
62lib/config.h.msvc : lib/config.h.in
63	sed -e 's/#undef WORDS_LITTLEENDIAN$$/#define WORDS_LITTLEENDIAN 1/' < $< > $@
64
65include/iconv.h.msvc-static : include/iconv.h.in
66	sed -e 's/@ICONV_CONST@/const/g' < $< > $@
67
68include/iconv.h.msvc-shared : include/iconv.h.in windows/dllexport.h
69	sed -e 's/@ICONV_CONST@/const/g' -e 's/extern \([^"]\)/extern LIBICONV_DLL_EXPORTED \1/' -e '/_LIBICONV_VERSION/r windows/dllexport.h' < $< > $@
70
71
72# We use "-7" to make a smaller table, but use "unsigned char" array indices
73# to avoid gcc warning.
74lib/aliases.h : lib/aliases.gperf
75	$(GPERF) -t -L ANSI-C -H aliases_hash -N aliases_lookup -G -W aliases -7 -C -k '1,3-11,$$' -i 1 lib/aliases.gperf | sed -e 's/\[str/\[(unsigned char) str/' > tmp.h
76	$(CP) tmp.h lib/aliases.h
77	$(RM) tmp.h
78
79lib/aliases.gperf : lib/encodings.def lib/encodings_local.def lib/genaliases.c
80	$(CC) $(CFLAGS) lib/genaliases.c -o genaliases
81	./genaliases > lib/aliases.gperf
82	$(RM) genaliases
83
84lib/aliases_aix.h : lib/encodings_aix.def lib/genaliases2.c
85	$(CC) $(CFLAGS) -DUSE_AIX lib/genaliases2.c -o genaliases
86	./genaliases > lib/aliases_aix.h
87	$(RM) genaliases
88
89lib/aliases_osf1.h : lib/encodings_osf1.def lib/genaliases2.c
90	$(CC) $(CFLAGS) -DUSE_OSF1 lib/genaliases2.c -o genaliases
91	./genaliases > lib/aliases_osf1.h
92	$(RM) genaliases
93
94lib/aliases_dos.h : lib/encodings_dos.def lib/genaliases2.c
95	$(CC) $(CFLAGS) -DUSE_DOS lib/genaliases2.c -o genaliases
96	./genaliases > lib/aliases_dos.h
97	$(RM) genaliases
98
99lib/aliases_extra.h : lib/encodings_extra.def lib/genaliases2.c
100	$(CC) $(CFLAGS) -DUSE_EXTRA lib/genaliases2.c -o genaliases
101	./genaliases > lib/aliases_extra.h
102	$(RM) genaliases
103
104
105lib/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
106	$(CC) $(CFLAGS) lib/genflags.c -o genflags
107	./genflags > lib/flags.h
108	$(RM) genflags
109
110
111lib/translit.h : lib/translit.def lib/gentranslit.c
112	$(CC) $(CFLAGS) lib/gentranslit.c -o gentranslit
113	./gentranslit < lib/translit.def > lib/translit.h
114	$(RM) gentranslit
115
116
117man/%.html : man/%
118	$(MAN2HTML) $< > $@
119
120
121force :
122