-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
144 lines (115 loc) · 3.78 KB
/
Makefile
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
## Programs and flags
CC = $(CROSS_COMPILE)gcc
CFLAGS = -g -Os
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
GTK_CFLAGS = `$(PKG_CONFIG) --cflags gtk+-2.0`
GTK_LIBS = `$(PKG_CONFIG) --libs gtk+-2.0`
CURL_CFLAGS = `$(PKG_CONFIG) --cflags libcurl`
CURL_LIBS = `$(PKG_CONFIG) --libs libcurl`
WFDB_CONFIG = $(CROSS_COMPILE)wfdb-config
WFDB_CFLAGS = `$(WFDB_CONFIG) --cflags`
WFDB_LIBS = `$(WFDB_CONFIG) --libs`
## Compilation options
cflags1 = $(CFLAGS) $(CPPFLAGS) -DMETAANN_VERSION=\"$(PACKAGE_VERSION)\" $(DEFS) \
$(GTK_CFLAGS) $(CURL_CFLAGS) $(WFDB_CFLAGS) -Wimplicit
cflags2 = $(cflags1) -W -Wall -Wformat=2 -Wwrite-strings -Wmissing-prototypes
libs = $(GTK_LIBS) $(WFDB_LIBS) $(CURL_LIBS) $(LIBS)
objs = metaann.o conf.o url.o annot.o grid.o init.o modepan.o sig.o wave_widget.o wave_window.o
## Package information
PACKAGE_TARNAME = metaann
PACKAGE_VERSION = 0.5
SRCPACKAGE = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
W32PACKAGE = $(PACKAGE_TARNAME)-w32
srcfiles = Makefile *.c *.h
datafiles = NEWS COPYING *.ui metaann.conf default.conf
## W32 binary package information
DLLPREFIX = `$(PKG_CONFIG) --variable=exec_prefix gtk+-2.0`
sysdlls = msvcrt.dll kernel32.dll gdi32.dll imm32.dll ole32.dll \
shell32.dll user32.dll advapi32.dll ws2_32.dll comctl32.dll \
comdlg32.dll winspool.drv msimg32.dll gdiplus.dll dnsapi.dll \
shlwapi.dll usp10.dll crypt32.dll
CACERT = /etc/ssl/certs/ca-certificates.crt
#w32extrafiles = etc/fonts \
# lib/gtk-2.0/2.10.0/engines \
# lib/gtk-2.0/modules
##
all: metaann$(EXEEXT)
all-w32:
$(MAKE) all CROSS_COMPILE=i686-w64-mingw32- EXEEXT=.exe LDFLAGS=-mwindows
metaann$(EXEEXT): $(objs)
$(CC) $(LDFLAGS) $(objs) -o metaann$(EXEEXT) $(libs)
$(objs): *.h
metaann.o: metaann.c
$(CC) $(cflags2) -c metaann.c
conf.o: conf.c
$(CC) $(cflags2) -c conf.c
url.o: url.c
$(CC) $(cflags2) -c url.c
wave_window.o: wave_window.c
$(CC) $(cflags2) -c wave_window.c
annot.o: annot.c
$(CC) $(cflags1) -c annot.c
grid.o: grid.c
$(CC) $(cflags1) -c grid.c
init.o: init.c
$(CC) $(cflags1) -c init.c
modepan.o: modepan.c
$(CC) $(cflags1) -c modepan.c
sig.o: sig.c
$(CC) $(cflags1) -c sig.c
wave_widget.o: wave_widget.c
$(CC) $(cflags1) -c wave_widget.c
dist:
rm -rf $(SRCPACKAGE)
mkdir $(SRCPACKAGE)
cp -p $(srcfiles) $(SRCPACKAGE)
cp -p $(datafiles) $(SRCPACKAGE)
tar cfvj $(SRCPACKAGE).tar.bz2 $(SRCPACKAGE)
dist-w32:
$(MAKE) dist-binary CROSS_COMPILE=i686-w64-mingw32- EXEEXT=.exe LDFLAGS=-mwindows
dist-binary: all
rm -rf $(W32PACKAGE)
mkdir $(W32PACKAGE)
set -e; export LC_ALL=C; \
cd $(W32PACKAGE); \
ln -s ../metaann.exe; \
ln -s $(CACERT) curl-ca-bundle.crt; \
for f in $(w32extrafiles); do \
if ! [ -e $(DLLPREFIX)/$$f ]; then \
echo; \
echo " *** File not found: $$f ***"; \
echo " *** DLLPREFIX = $(DLLPREFIX) ***"; \
echo; \
exit 1; \
fi; \
mkdir -p `dirname $$f`; \
ln -s $(DLLPREFIX)/$$f $$f; \
done; \
newfiles=`find -L . -name '*.exe' -o -name '*.dll'`; \
while [ -n "$$newfiles" ]; do \
oldfiles=$$newfiles; \
newfiles=''; \
for f in $$oldfiles; do \
dlls=`objdump -p $$f | sed -n '/^\tDLL Name: /{s/.*: //;p}'`; \
for dll in $$dlls; do \
if ! [ -f $$dll ] && ! echo $(sysdlls) | grep -qwi $$dll; then \
if [ -f $(DLLPREFIX)/bin/$$dll ]; then \
ln -s $(DLLPREFIX)/bin/$$dll; \
newfiles="$$newfiles $$dll"; \
else \
echo; \
echo " *** Library not found: $$dll ***"; \
echo " *** DLLPREFIX = $(DLLPREFIX) ***"; \
echo; \
exit 1; \
fi; \
fi; \
done; \
done; \
done
cp -p $(datafiles) $(W32PACKAGE)
zip -9 -r $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)-w32.zip $(W32PACKAGE)
clean:
rm -f metaann metaann.exe
rm -f *.o
.PHONY: all all-w32 clean dist dist-w32 dist-binary