-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
103 lines (97 loc) · 4.99 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
#
# font-specimen
#
# Display Font Specimen
#
# Copyright (C) 2014 Petr Gajdos (pgajdos at suse)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
VERSION = 20150202
LIBRARY_NAME = font-specimen
LIBRARY_MAJOR = 0
LIBRARY_VERSION = 0.0.0
LIBRARY_LINK = lib$(LIBRARY_NAME).so
LIBRARY_FILE = lib$(LIBRARY_NAME).so.$(LIBRARY_VERSION)
LIBPNG_CFLAGS = $(shell pkg-config --cflags libpng)
LIBPNG_LIBS = $(shell pkg-config --libs libpng)
FT2_CFLAGS = $(shell pkg-config --cflags freetype2)
FT2_LIBS = $(shell pkg-config --libs freetype2)
HB_CFLAGS = $(shell pkg-config --cflags harfbuzz)
HB_LIBS = $(shell pkg-config --libs harfbuzz)
FC_CFLAGS = $(shell pkg-config --cflags fontconfig)
FC_LIBS = $(shell pkg-config --libs fontconfig)
MYCFLAGS = -DFONT_SPECIMEN_VERSION=$(VERSION) $(LIBPNG_CFLAGS) $(FT2_CFLAGS) $(HB_CFLAGS) $(FC_CFLAGS) -Wall -g
MYLIBS = $(FC_LIBS) $(LIBPNG_LIBS) $(FT2_LIBS) $(HB_LIBS)
OBJS = fc.o unicode.o hbz.o ft.o specimen.o img_png.o error.o
UNICODE_SOURCES = blocks-map.txt blocks.sh blocks.txt Blocks.txt Scripts.txt sentences.txt SOURCES UnicodeData.txt unicode.txt
UNICODE_SCRIPTS = collections-map.sh collections.sh scripts-map.sh scripts.sh unicode.sh
font-specimen: font-specimen.c .libs/$(LIBRARY_FILE)
gcc -L.libs $(MYCFLAGS) $(CFLAGS) $(MYLDFLAGS) $(LDLAGS) -o font-specimen font-specimen.c -l$(LIBRARY_NAME)
.libs/$(LIBRARY_FILE): $(OBJS) font-specimen.pc
mkdir -p .libs
gcc $(MYCFLAGS) $(CFLAGS) -shared -Wl,-soname,${LIBRARY_LINK}.$(LIBRARY_MAJOR) -o .libs/$(LIBRARY_FILE) $(OBJS) $(MYLIBS)
ln -sf $(LIBRARY_FILE) .libs/$(LIBRARY_LINK)
ln -sf $(LIBRARY_FILE) .libs/$(LIBRARY_LINK).$(LIBRARY_MAJOR)
specimen.o: specimen.c specimen.h unicode.h fc.h ft.h img_png.h error.h
gcc -c -fPIC $(MYCFLAGS) $(CFLAGS) specimen.c
fc.o: fc.c fc.h unicode.h error.h
gcc -c -fPIC $(MYCFLAGS) $(CFLAGS) fc.c
unicode.o: unicode.c unicode.h fc.h error.h unicode/scripts.txt unicode/scripts-map.txt unicode/blocks-map.txt
gcc -c -fPIC $(MYCFLAGS) $(CFLAGS) unicode.c
unicode.h: unicode/sentences.txt
touch unicode.h
hbz.o: hbz.c hbz.h error.h
gcc -c -fPIC $(MYCFLAGS) $(CFLAGS) hbz.c
ft.o: ft.c ft.h fc.h error.h
gcc -c -fPIC $(MYCFLAGS) $(CFLAGS) ft.c
img_png.o: img_png.c img_png.h error.h
gcc -c -fPIC $(MYCFLAGS) $(CFLAGS) img_png.c
error.o: error.c error.h
gcc -c -fPIC $(MYCFLAGS) $(CFLAGS) error.c
unicode/scripts.txt: unicode/Scripts.txt unicode/scripts.sh unicode/collections.sh
cd unicode; cat Scripts.txt | sh scripts.sh > scripts.txt; sh collections.sh >> scripts.txt
unicode/scripts-map.txt: unicode/Scripts.txt unicode/scripts-map.sh unicode/collections-map.sh
cd unicode; cat Scripts.txt | sh scripts-map.sh > scripts-map.txt; cat Scripts.txt Blocks.txt | sh collections-map.sh >> scripts-map.txt;
unicode/blocks-map.txt: unicode/Blocks.txt unicode/blocks.sh
cd unicode; cat Blocks.txt | sh blocks.sh > blocks-map.txt
font-specimen.pc: font-specimen.pc.in
cp -f font-specimen.pc.in font-specimen.pc
sed -i "s:@VERSION@:$(VERSION):" font-specimen.pc
sed -i "s:@INCLUDEDIR@:$(INCLUDEDIR):" font-specimen.pc
sed -i "s:@LIBDIR@:$(LIBDIR):" font-specimen.pc
sed -i "s:@LIBS@:-l$(LIBRARY_NAME):" font-specimen.pc
clean:
rm -rf *.o font-specimen unicode/scripts.txt unicode/scripts-map.txt .libs font-specimen.pc
install: font-specimen
mkdir -p $(DESTDIR)/$(INCLUDEDIR)
install -m 0644 specimen.h $(DESTDIR)/$(INCLUDEDIR)/font-specimen.h
mkdir -p $(DESTDIR)/$(LIBDIR)
install -m 0644 .libs/$(LIBRARY_FILE) $(DESTDIR)/$(LIBDIR)
ln -sf $(LIBRARY_FILE) $(DESTDIR)/$(LIBDIR)/$(LIBRARY_LINK).${LIBRARY_MAJOR}
ln -sf $(LIBRARY_FILE) $(DESTDIR)/$(LIBDIR)/$(LIBRARY_LINK)
mkdir -p -m 0755 $(DESTDIR)/$(BINDIR)
install -m 0755 font-specimen $(DESTDIR)/$(BINDIR)
mkdir -p $(DESTDIR)/$(PKG_CONFIG_DIR)
install -m 0644 font-specimen.pc $(DESTDIR)/$(PKG_CONFIG_DIR)
release: font-specimen
mkdir -p $(LIBRARY_NAME)-$(VERSION)
cp -r *.c *.h Makefile font-specimen.pc.in $(LIBRARY_NAME)-$(VERSION)
mkdir -p $(LIBRARY_NAME)-$(VERSION)/unicode
for f in $(UNICODE_SOURCES) $(UNICODE_SCRIPTS); do \
cp unicode/$$f $(LIBRARY_NAME)-$(VERSION)/unicode; \
done
cp ChangeLog INSTALL README.md $(LIBRARY_NAME)-$(VERSION)
tar cvjf $(LIBRARY_NAME)-$(VERSION).tar.bz2 $(LIBRARY_NAME)-$(VERSION)
rm -r $(LIBRARY_NAME)-$(VERSION)