3 # Makefile for libcharset.
5 # This Makefile should be sufficient to build libcharset and its
6 # demo application all on its own. However, it's also a valid
7 # Makefile _fragment_ which can be linked in to another program
8 # Makefile to allow libcharset to be built directly into its
11 # To include this as part of another Makefile, you need to:
13 # - Define $(LIBCHARSET_SRCDIR) to be a directory prefix (i.e.
14 # probably ending in a slash) which allows access to the
15 # libcharset source files.
17 # - Define $(LIBCHARSET_OBJDIR) to be a directory prefix (i.e.
18 # probably ending in a slash) which allows access to the
19 # directory where the libcharset object files need to be put.
21 # - Define $(LIBCHARSET_OBJPFX) to be a filename prefix to be
22 # applied to the libcharset object files (in case, for example,
23 # the file names clash with those of the main application, and
24 # you need to call them cs-*.o to resolve the clash).
26 # - Define $(LIBCHARSET_GENPFX) to be a prefix to be added to
27 # targets such as `all' and `clean'. (Mostly the point of this
28 # is to get those targets out of the way for the Makefile
29 # fragment including us.)
31 # - If you need your compiler to use the -MD flag, define $(MD) to
34 # This Makefile fragment will then define rules for building each
35 # object file, and will in turn define $(LIBCHARSET_OBJS) to be
36 # what you need to add to your link line.
38 $(LIBCHARSET_GENPFX
)all: \
39 $(LIBCHARSET_OBJDIR
)libcharset.a \
40 $(LIBCHARSET_OBJDIR
)convcs
42 $(LIBCHARSET_OBJDIR
)convcs
: $(LIBCHARSET_OBJDIR
)libcharset.a
43 $(CC
) $(CFLAGS
) -o
$(LIBCHARSET_OBJDIR
)convcs \
44 $(LIBCHARSET_SRCDIR
)test.c \
45 $(LIBCHARSET_OBJDIR
)libcharset.a
48 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)big5enc.o \
49 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)big5set.o \
50 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)cp949.o \
51 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)euc.o \
52 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)fromucs.o \
53 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)gb2312.o \
54 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)hz.o \
55 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)iso2022s.o \
56 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)istate.o \
57 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)jisx0208.o \
58 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)jisx0212.o \
59 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)ksx1001.o \
60 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)localenc.o \
61 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)macenc.o \
62 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)mimeenc.o \
63 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)sbcs.o \
64 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)sbcsdat.o \
65 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)shiftjis.o \
66 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)slookup.o \
67 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)superset.o \
68 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)toucs.o \
69 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)utf16.o \
70 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)utf7.o \
71 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)utf8.o \
72 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)xenc.o \
75 $(LIBCHARSET_OBJDIR
)libcharset.a
: $(LIBCHARSET_OBJS
)
76 ar rcs
$@
$(LIBCHARSET_OBJS
)
78 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)big5enc.o
: \
79 $(LIBCHARSET_SRCDIR
)big5enc.c
80 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
82 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)big5set.o
: \
83 $(LIBCHARSET_SRCDIR
)big5set.c
84 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
86 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)cp949.o
: \
87 $(LIBCHARSET_SRCDIR
)cp949.c
88 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
90 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)euc.o
: \
91 $(LIBCHARSET_SRCDIR
)euc.c
92 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
94 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)fromucs.o
: \
95 $(LIBCHARSET_SRCDIR
)fromucs.c
96 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
98 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)gb2312.o
: \
99 $(LIBCHARSET_SRCDIR
)gb2312.c
100 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
102 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)hz.o
: \
103 $(LIBCHARSET_SRCDIR
)hz.c
104 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
106 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)iso2022s.o
: \
107 $(LIBCHARSET_SRCDIR
)iso2022s.c
108 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
110 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)istate.o
: \
111 $(LIBCHARSET_SRCDIR
)istate.c
112 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
114 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)jisx0208.o
: \
115 $(LIBCHARSET_SRCDIR
)jisx0208.c
116 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
118 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)jisx0212.o
: \
119 $(LIBCHARSET_SRCDIR
)jisx0212.c
120 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
122 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)ksx1001.o
: \
123 $(LIBCHARSET_SRCDIR
)ksx1001.c
124 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
126 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)localenc.o
: \
127 $(LIBCHARSET_SRCDIR
)localenc.c
128 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
130 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)macenc.o
: \
131 $(LIBCHARSET_SRCDIR
)macenc.c
132 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
134 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)mimeenc.o
: \
135 $(LIBCHARSET_SRCDIR
)mimeenc.c
136 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
138 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)sbcs.o
: \
139 $(LIBCHARSET_SRCDIR
)sbcs.c
140 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
142 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)shiftjis.o
: \
143 $(LIBCHARSET_SRCDIR
)shiftjis.c
144 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
146 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)slookup.o
: \
147 $(LIBCHARSET_SRCDIR
)slookup.c
148 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
150 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)superset.o
: \
151 $(LIBCHARSET_SRCDIR
)superset.c
152 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
154 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)toucs.o
: \
155 $(LIBCHARSET_SRCDIR
)toucs.c
156 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
158 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)utf16.o
: \
159 $(LIBCHARSET_SRCDIR
)utf16.c
160 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
162 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)utf7.o
: \
163 $(LIBCHARSET_SRCDIR
)utf7.c
164 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
166 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)utf8.o
: \
167 $(LIBCHARSET_SRCDIR
)utf8.c
168 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
170 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)xenc.o
: \
171 $(LIBCHARSET_SRCDIR
)xenc.c
172 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
174 # This object file is special, because its source file is itself
175 # generated - and therefore goes in the object directory.
177 $(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)sbcsdat.o
: \
178 $(LIBCHARSET_OBJDIR
)sbcsdat.c
179 $(CC
) $(CFLAGS
) $(MD
) -c
-o
$@
$<
181 $(LIBCHARSET_OBJDIR
)sbcsdat.c
: \
182 $(LIBCHARSET_SRCDIR
)sbcs.dat \
183 $(LIBCHARSET_SRCDIR
)sbcsgen.pl
184 perl
$(LIBCHARSET_SRCDIR
)sbcsgen.pl \
185 $(LIBCHARSET_SRCDIR
)sbcs.dat
$@
187 $(LIBCHARSET_GENPFX
)clean:
188 rm -f
$(LIBCHARSET_OBJDIR
)$(LIBCHARSET_OBJPFX
)*.o \
189 $(LIBCHARSET_OBJDIR
)libcharset.a \
190 $(LIBCHARSET_OBJDIR
)sbcsdat.c \
191 $(LIBCHARSET_OBJDIR
)convcs