summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 4c20a0818ed3c1eea4fd5841c3f1677f8f17014c (plain) (blame)
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
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

OS = linux
# Linux:   linux
# Mac OS:  macos
# Windows: windows
include mk/$(OS).mk


LIB_MAJOR = 0
LIB_MINOR = 1
LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)


MODULES =\
	head\
	bhed\
	hhea\
	hmtx\
	vhea\
	vmtx\
	maxp\
	loca\
	name\
	fmtx\
	ltag\
	xref\
	trak\
	gcid\
	fpgm\
	fdsc\
	gasp\
	avar\
	meta\
	hdmx\
	post\
	cmap\
	bdat\
	bloc\
	sbix\
	ebsc

OBJ =\
	libparsesfnt_parse___.o\
	libparsesfnt_parse_fontdir.o\
	libparsesfnt_parse_tabdir.o\
	$(MODULES:=.o)

HDR =\
	libparsesfnt.h\
	common.h

LOBJ = $(OBJ:.o=.lo)


AR_OBJ = $(OBJ)
# Using "AR_OBJ=libparsesfnt-all.o" can reduce the size of the
# library, however this may affect the size of applications that
# don't use most of the functions. If you are compiling for your
# application specification you can combine this with setting
# MODULES to the parts your application will use; note however
# that 'fpgm' covers both 'fpgm' and 'prep'.

SO_LOBJ = $(LOBJ)
# You may use "SO_LOBJ=libparsesfnt-all.lo".


all: libparsesfnt.a libparsesfnt.$(LIBEXT)
$(OBJ): $(@:.o=.c) $(HDR)
$(LOBJ): $(@:.o=.c) $(HDR)
libparsesfnt-all.o: libparsesfnt-all.c $(HDR)
libparsesfnt-all.lo: libparsesfnt-all.c $(HDR)

libparsesfnt-all.c: $(OBJ:.o=.c)
	cat $(OBJ:.o=.c) > $@

.c.o:
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

.c.lo:
	$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

libparsesfnt.$(LIBEXT): $(SO_LOBJ)
	$(CC) $(LIBFLAGS) -o $@ $(SO_LOBJ) $(LDFLAGS)

libparsesfnt.a: $(AR_OBJ)
	@rm -f -- $@
	$(AR) rc $@ $(AR_OBJ)

install: libparsesfnt.a libparsesfnt.$(LIBEXT)
	mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
	mkdir -p -- "$(DESTDIR)$(PREFIX)/include"
	cp -- libparsesfnt.a "$(DESTDIR)$(PREFIX)/lib/"
	cp -- libparsesfnt.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.$(LIBMINOREXT)"
	$(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.$(LIBMINOREXT)"
	ln -sf -- "libparsesfnt.$(LIBMINOREXT)" "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.$(LIBMAJOREXT)"
	ln -sf -- "libparsesfnt.$(LIBMAJOREXT)" "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.$(LIBEXT)"
	cp -- libparsesfnt.h "$(DESTDIR)$(PREFIX)/include/"

uninstall:
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.a"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.$(LIBEXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.$(LIBMAJOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libparsesfnt.$(LIBMINOREXT)"
	-rm -f -- "$(DESTDIR)$(PREFIX)/include/libparsesfnt.h"

clean:
	-rm -f -- *.o *.a *.lo *.su *.so *.so.* *.gch *.gcov *.gcno *.gcda
	-rm -f -- libparsesfnt-all.c

.SUFFIXES:
.SUFFIXES: .lo .o .c

.PHONY: all install uninstall clean