forked from libxmp/libxmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
361 lines (300 loc) · 11.7 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
VERSION_MAJOR = @libxmp_VERSION_MAJOR@
VERSION_MINOR = @libxmp_VERSION_MINOR@
VERSION_RELEASE = @libxmp_VERSION_PATCH@
VERSION = @libxmp_VERSION@
# This dylib will support anything linked against COMPAT_VERSION through VERSION
COMPAT_VERSION = $(VERSION_MAJOR)
CC = @CC@
CFLAGS = -c @CFLAGS@
CPPFLAGS = -Iinclude -D_REENTRANT @DEFS@ @CPPFLAGS@
#CFLAGS += -DDEBUG
CFLAGS_SHARED = @CFLAGS_SHARED@
CFLAGS_STATIC = -DLIBXMP_STATIC
LD = @CC@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
AR = @AR@
RANLIB = @RANLIB@
INSTALL = @INSTALL@
DESTDIR =
prefix = @prefix@
exec_prefix = @prefix@
datarootdir = @datarootdir@
BINDIR = @bindir@
LIBDIR = @libdir@
MANDIR = @mandir@/man3
INCLUDEDIR = @includedir@
LD_VERSCRIPT = @LD_VERSCRIPT@
SHELL = /bin/sh
DIST = libxmp-$(VERSION)
DFILES = README INSTALL install-sh configure configure.ac config.sub config.guess \
Makefile.in Makefile.vc Makefile.dos Makefile.os2 Makefile.w32 watcom.mif \
CMakeLists.txt aclocal.m4 autogen.sh libxmp.map libxmp.pc.in libxmp-config.cmake \
libxmp-config.cmake.autotools libxmp-config-version.cmake.autotools.in
DDIRS = docs include src loaders prowiz depackers lhasa lite test cmake m4
V = 0
LIB = libxmp.a
SOLIB = libxmp.so
SHLIB = $(SOLIB).$(VERSION)
SONAME = $(SOLIB).$(VERSION_MAJOR)
DLL = libxmp.dll
IMPLIB = libxmp.dll.a
DYLIB = libxmp.$(VERSION_MAJOR).dylib
GCLIB = libxmp-gc.a
LIB_LITE = libxmp-lite.a
SOLIB_LITE = libxmp-lite.so
SHLIB_LITE = $(SOLIB_LITE).$(VERSION)
SONAME_LITE = $(SOLIB_LITE).$(VERSION_MAJOR)
DLL_LITE = libxmp-lite.dll
IMPLIB_LITE = libxmp-lite.dll.a
DYLIB_LITE = libxmp-lite.$(VERSION_MAJOR).dylib
GCLIB_LITE = libxmp-lite-gc.a
DYLIB_COMPAT = -compatibility_version,$(COMPAT_VERSION),
DARWIN_VERSION = @DARWIN_VERSION@
# https://github.com/cmatsuoka/libxmp/issues/1
ifneq ($(DARWIN_VERSION),)
ifeq ($(shell test $(DARWIN_VERSION) -lt 9 && echo true), true)
DYLIB_COMPAT=
endif
endif
all: @STATIC@ @SHARED@
include include/Makefile
include cmake/Makefile
include m4/Makefile
include src/Makefile
include src/loaders/Makefile
include src/loaders/prowizard/Makefile
include src/depackers/Makefile
include src/depackers/lhasa/Makefile
include src/lite/Makefile
include test/Makefile
include docs/Makefile
ALL_OBJS=$(OBJS) @PROWIZARD_OBJS@ @DEPACKER_OBJS@
LOBJS = $(ALL_OBJS:.o=.lo)
GCOBJS = $(ALL_OBJS:.o=.gco)
LOBJS_LITE = $(LITE_OBJS:.o=.lo)
GCOBJS_LITE = $(LITE_OBJS:.o=.gco)
.SUFFIXES: .c .o .lo .a .so .dll .in .gco .gcda .gcno
.c.o:
@CMD='$(CC) $(CPPFLAGS) $(CFLAGS_STATIC) $(CFLAGS) -o $*.o $<'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo CC $*.o ; fi; \
eval $$CMD
.c.lo:
@CMD='$(CC) $(CPPFLAGS) $(CFLAGS_SHARED) $(CFLAGS) -o $*.lo $<'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo CC $*.lo ; fi; \
eval $$CMD
.c.gco:
@CMD='$(CC) $(CPPFLAGS) $(CFLAGS_STATIC) $(CFLAGS) -O0 -fno-inline -fprofile-arcs -ftest-coverage -o $*.gco $<'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo CC $*.gco ; fi; \
eval $$CMD
static: lib/$(LIB)
shared: lib/$(SHLIB)
coverage: lib/$(GCLIB)
dll: lib/$(DLL)
dylib: lib/$(DYLIB)
static-lite: lib/$(LIB_LITE)
shared-lite: lib/$(SHLIB_LITE)
coverage-lite: lib/$(GCLIB_LITE)
dll-lite: lib/$(DLL_LITE)
dylib-lite: lib/$(DYLIB_LITE)
lib/$(LIB): $(ALL_OBJS)
@mkdir -p lib
@CMD='$(AR) r $@ $(ALL_OBJS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo AR $@ ; fi; \
eval $$CMD
$(RANLIB) $@
lib/$(SHLIB): $(LOBJS)
@mkdir -p lib
@CMD='$(LD) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) $(LD_VERSCRIPT) -o $@ $(LOBJS) $(LIBS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo LD $@ ; fi; \
eval $$CMD
ln -sf $(SHLIB) lib/$(SONAME)
ln -sf $(SONAME) lib/$(SOLIB)
lib/$(DLL): $(LOBJS)
@mkdir -p lib
@CMD='$(LD) $(LDFLAGS) -shared -Wl,--output-def,lib/libxmp.def,--out-implib,lib/$(IMPLIB) -o $@ $(LOBJS) $(LIBS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo LD $@ ; fi; \
eval $$CMD
lib/$(LIB_LITE): $(LITE_OBJS)
@mkdir -p lib
@CMD='$(AR) r $@ $(LITE_OBJS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo AR $@ ; fi; \
eval $$CMD
$(RANLIB) $@
lib/$(SHLIB_LITE): $(LOBJS_LITE)
@mkdir -p lib
@CMD='$(LD) $(LDFLAGS) -shared -Wl,-soname,$(SONAME_LITE) $(LD_VERSCRIPT) -o $@ $(LOBJS_LITE) $(LIBS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo LD $@ ; fi; \
eval $$CMD
ln -sf $(SHLIB_LITE) lib/$(SONAME_LITE)
ln -sf $(SONAME_LITE) lib/$(SOLIB_LITE)
lib/$(DLL_LITE): $(LOBJS_LITE)
@mkdir -p lib
@CMD='$(LD) $(LDFLAGS) -shared -Wl,--output-def,lib/libxmp-lite.def,--out-implib,lib/$(IMPLIB_LITE) -o $@ $(LOBJS_LITE) $(LIBS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo LD $@ ; fi; \
eval $$CMD
# From http://stackoverflow.com/questions/15905310:
# The version number checks that dyld performs are limited to ensuring that
# the compatibility version of the library being loaded is higher than the
# compatibility version of the library that was used at build time.
#
lib/$(DYLIB): $(LOBJS)
@mkdir -p lib
@CMD='$(LD) $(LDFLAGS) -dynamiclib -Wl,-headerpad_max_install_names,$(DYLIB_COMPAT)-current_version,$(VERSION),-install_name,$(prefix)/lib/$(DYLIB) -o $@ $(LOBJS) $(LIBS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo LD $@ ; fi; \
eval $$CMD
ln -sf $(DYLIB) lib/libxmp.dylib
lib/$(GCLIB): $(GCOBJS)
@mkdir -p lib
@CMD='$(AR) r $@ $(GCOBJS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo AR $@ ; fi; \
eval $$CMD
$(RANLIB) $@
lib/$(DYLIB_LITE): $(LOBJS_LITE)
@mkdir -p lib
@CMD='$(LD) $(LDFLAGS) -dynamiclib -Wl,-headerpad_max_install_names,$(DYLIB_COMPAT)-current_version,$(VERSION),-install_name,$(prefix)/lib/$(DYLIB_LITE) -o $@ $(LOBJS_LITE) $(LIBS)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo LD $@ ; fi; \
eval $$CMD
ln -sf $(DYLIB) lib/libxmp-lite.dylib
lib/$(GCLIB_LITE): $(GCOBJS_LITE)
@mkdir -p lib
@CMD='$(AR) r $@ $(GCOBJS_LITE)'; \
if [ "$(V)" -gt 0 ]; then echo $$CMD; else echo AR $@ ; fi; \
eval $$CMD
$(RANLIB) $@
docs: all-docs
clean:
@rm -f $(ALL_OBJS) $(LOBJS) $(T_OBJS)
@rm -f $(GCOBJS) $(ALL_OBJS:.o=.gcno) $(ALL_OBJS:.o=.gcda)
@rm -f $(LITE_OBJS) $(LOBJS_LITE) $(TLITE_OBJS)
@rm -f $(GCOBJS_LITE) $(LITE_OBJS:.o=.gcno) $(LITE_OBJS:.o=.gcda)
distclean: clean
@rm -f config.log config.cache config.status *.pc *-version.cmake.autotools depend Makefile lib/* test/libxmp-test* test/libxmp-lite-test*
install: all
@mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR)
@if [ -f lib/$(LIB) ]; then \
echo "Installing $(LIB)..."; \
$(INSTALL) -m644 lib/$(LIB) $(DESTDIR)$(LIBDIR); \
fi
@if [ -f lib/$(DYLIB) ]; then \
echo "Installing $(DYLIB)..."; \
$(INSTALL) -m755 lib/$(DYLIB) $(DESTDIR)$(LIBDIR); \
ln -sf $(DYLIB) $(DESTDIR)$(LIBDIR)/libxmp.dylib; \
fi
@if [ -f lib/$(DLL) ]; then \
echo "Installing $(DLL)..."; \
$(INSTALL) -m644 lib/$(DLL) $(DESTDIR)$(BINDIR); \
$(INSTALL) -m644 lib/$(IMPLIB) $(DESTDIR)$(LIBDIR); \
fi
@if [ -f lib/$(SHLIB) ]; then \
echo "Installing $(SHLIB)..."; \
$(INSTALL) -m755 lib/$(SHLIB) $(DESTDIR)$(LIBDIR); \
ln -sf $(SHLIB) $(DESTDIR)$(LIBDIR)/$(SONAME); \
ln -sf $(SONAME) $(DESTDIR)$(LIBDIR)/$(SOLIB); \
fi
@if [ -f lib/$(LIB_LITE) ]; then \
echo "Installing $(LIB_LITE)..."; \
$(INSTALL) -m644 lib/$(LIB_LITE) $(DESTDIR)$(LIBDIR); \
fi
@if [ -f lib/$(DYLIB_LITE) ]; then \
echo "Installing $(DYLIB_LITE)..."; \
$(INSTALL) -m755 lib/$(DYLIB_LITE) $(DESTDIR)$(LIBDIR); \
ln -sf $(DYLIB_LITE) $(DESTDIR)$(LIBDIR_LITE)/libxmp-lite.dylib; \
fi
@if [ -f lib/$(DLL_LITE) ]; then \
echo "Installing $(DLL_LITE)..."; \
$(INSTALL) -m644 lib/$(DLL_LITE) $(DESTDIR)$(BINDIR); \
$(INSTALL) -m644 lib/$(IMPLIB_LITE) $(DESTDIR)$(LIBDIR); \
fi
@if [ -f lib/$(SHLIB_LITE) ]; then \
echo "Installing $(SHLIB_LITE)..."; \
$(INSTALL) -m755 lib/$(SHLIB_LITE) $(DESTDIR)$(LIBDIR); \
ln -sf $(SHLIB_LITE) $(DESTDIR)$(LIBDIR)/$(SONAME_LITE); \
ln -sf $(SONAME_LITE) $(DESTDIR)$(LIBDIR)/$(SOLIB_LITE); \
fi
@echo "Installing xmp.h..."
@$(INSTALL) -m644 include/xmp.h $(DESTDIR)$(INCLUDEDIR)
@echo "Installing libxmp.pc..."
@mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
@$(INSTALL) -m644 libxmp.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
@echo "Installing libxmp-config.cmake..."
@mkdir -p $(DESTDIR)$(LIBDIR)/cmake/libxmp
@$(INSTALL) -m644 libxmp-config.cmake.autotools $(DESTDIR)$(LIBDIR)/cmake/libxmp/libxmp-config.cmake
@$(INSTALL) -m644 libxmp-config-version.cmake.autotools $(DESTDIR)$(LIBDIR)/cmake/libxmp/libxmp-config-version.cmake
@if [ -f libxmp-lite.pc ]; then \
echo "Installing libxmp-lite/xmp.h..."; \
mkdir -p $(DESTDIR)$(INCLUDEDIR)/libxmp-lite; \
$(INSTALL) -m644 include/xmp.h $(DESTDIR)$(INCLUDEDIR)/libxmp-lite; \
echo "Installing libxmp-lite.pc..."; \
mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig; \
$(INSTALL) -m644 libxmp-lite.pc $(DESTDIR)$(LIBDIR)/pkgconfig/; \
echo "Installing libxmp-lite-config.cmake..."; \
mkdir -p $(DESTDIR)$(LIBDIR)/cmake/libxmp-lite; \
$(INSTALL) -m644 src/lite/libxmp-lite-config.cmake.autotools $(DESTDIR)$(LIBDIR)/cmake/libxmp-lite/libxmp-lite-config.cmake; \
$(INSTALL) -m644 libxmp-lite-config-version.cmake.autotools $(DESTDIR)$(LIBDIR)/cmake/libxmp-lite/libxmp-lite-config-version.cmake; \
fi
#FIXME: do better?
depend:
@echo Building dependencies...
@echo > $@
@for i in $(ALL_OBJS) $(LITE_OBJS) $(T_OBJS) $(TLITE_OBJS); do \
c="$${i%.o}.c"; l="$${i%.o}.lo"; \
$(CC) $(CFLAGS) $(CPPFLAGS) -MM $$c | \
sed "s!^.*\.o:!$$i $$l:!" >> $@ ; \
done
dist: version-prepare all-docs dist-prepare dist-jni dist-subdirs
dist-jni:
mkdir $(DIST)/jni
cp jni/Android.mk jni/Application.mk $(DIST)/jni
dist-prepare: cmake-prepare vc-prepare watcom-prepare
./config.status
rm -Rf $(DIST) $(DIST).tar.gz
mkdir -p $(DIST)
cp -RPp $(DFILES) $(DIST)/
space := $(eval) $(eval)
cmake-prepare:
@echo Generate cmake/libxmp-sources.cmake
@sed -e 's!@SRCS@!\n$(subst $(space), , $(OBJS:.o=.c\n))!' \
-e 's!@PSRCS@!\n$(subst $(space), , $(PROWIZARD_OBJS:.o=.c\n))!' \
-e 's!@DSRCS@!\n$(subst $(space), , $(DEPACKER_OBJS:.o=.c\n))!' \
-e 's!@LITE_SRCS@!\n$(subst $(space), , $(LITE_OBJS:.o=.c\n))!' \
cmake/libxmp-sources.cmake.in > cmake/libxmp-sources.cmake
vc-prepare:
@echo Generate Makefile.vc
@sed -e 's!@OBJS@!\\\r\n $(subst /,\\,$(OBJS:.o=.obj \\\r\n))!' \
-e 's!@POBJS@!\\\r\n $(subst /,\\,$(PROWIZARD_OBJS:.o=.obj \\\r\n))!' \
-e 's!@DOBJS@!\\\r\n $(subst /,\\,$(DEPACKER_OBJS:.o=.obj \\\r\n))!' \
-e 's!@LITE_OBJS@!\\\r\n $(subst /,\\,$(LITE_OBJS:.o=.obj \\\r\n))!' \
Makefile.vc.in > Makefile.vc
watcom-prepare:
@echo Generate watcom.mif
@sed -e 's!@OBJS@! \&\n $(OBJS:.o=.obj \&\n)!' \
-e 's!@POBJS@! \&\n $(PROWIZARD_OBJS:.o=.obj \&\n)!' \
-e 's!@DOBJS@! \&\n $(DEPACKER_OBJS:.o=.obj \&\n)!' \
-e 's!@LITE_OBJS@! \&\n $(LITE_OBJS:.o=.obj \&\n)!' \
watcom.mif.in > watcom.mif
dist-subdirs: $(addprefix dist-,$(DDIRS))
chmod -R u+w $(DIST)/*
tar cvf - $(DIST) | gzip -9c > $(DIST).tar.gz
rm -Rf $(DIST)
ls -l $(DIST).tar.gz
distcheck:
rm -Rf $(DIST)
tar xf $(DIST).tar.gz
(cd $(DIST); ./configure --enable-lite --enable-static --prefix=`pwd`/test-install; make; make check check-lite; make install; find test-install)
devcheck:
$(MAKE) -C test-dev
covercheck: coverage
$(MAKE) -C test-dev covercheck
coverclean:
@rm -f $(ALL_OBJS:.o=.gco) $(ALL_OBJS:.o=.gcno) $(ALL_OBJS:.o=.gcda)
$(MAKE) -C test-dev coverclean
$(ALL_OBJS): Makefile
$(LITE_OBJS): Makefile
$(LOBJS): Makefile
$(LOBJS_LITE): Makefile
version-prepare:
vercode=`printf "0x%02x%02x%02x" $(VERSION_MAJOR) $(VERSION_MINOR) $(VERSION_RELEASE)`; \
sed -i -e "s/\(^#define XMP_VERSION\).*/\1 \"$(VERSION)\"/;s/\(^#define XMP_VERCODE\).*/\1 $$vercode/;s/\(^#define XMP_VER_MAJOR\).*/\1 $(VERSION_MAJOR)/;s/\(^#define XMP_VER_MINOR\).*/\1 $(VERSION_MINOR)/;s/\(^#define XMP_VER_RELEASE\).*/\1 $(VERSION_RELEASE)/" include/xmp.h
./config.status
sinclude depend