| 1 |
# gmake |
| 2 |
|
| 3 |
NAME = ttf2woff |
| 4 |
VERSION = 0.14 |
| 5 |
BINDIR = /usr/local/bin |
| 6 |
PKG=$(NAME)-$(VERSION) |
| 7 |
FILES_TTF2WOFF := Makefile ttf2woff.c ttf2woff.h genwoff.c genttf.c readttf.c readttc.c readwoff.c optimize.c \ |
| 8 |
comp-zlib.c comp-zopfli.c compat.c ttf2woff.rc zopfli.diff |
| 9 |
FILES_ZOPFLI := zopfli.h symbols.h \ |
| 10 |
$(patsubst %,%.h,zlib_container deflate lz77 blocksplitter squeeze hash cache tree util katajainen) \ |
| 11 |
$(patsubst %,%.c,zlib_container deflate lz77 blocksplitter squeeze hash cache tree util katajainen) |
| 12 |
FILES += $(FILES_TTF2WOFF) $(addprefix zopfli/,$(FILES_ZOPFLI)) |
| 13 |
|
| 14 |
ZOPFLI = 1 |
| 15 |
|
| 16 |
OBJ := ttf2woff.o readttf.o readttc.o readwoff.o genwoff.o genttf.o optimize.o |
| 17 |
ifeq ($(ZOPFLI),) |
| 18 |
OBJ += comp-zlib.o |
| 19 |
else |
| 20 |
OBJ += comp-zopfli.o |
| 21 |
LDFLAGS += -lm |
| 22 |
endif |
| 23 |
|
| 24 |
CFLAGS ?= -O2 -g |
| 25 |
LDFLAGS += -lz |
| 26 |
|
| 27 |
# eg. make WIN32=1 CC=mingw32-gcc RC=mingw32-windres |
| 28 |
ifdef WIN32 |
| 29 |
EXE = .exe |
| 30 |
CFLAGS += -DNO_ERRWARN |
| 31 |
OBJ += compat.o rc.o |
| 32 |
endif |
| 33 |
|
| 34 |
ttf2woff$(EXE): $(OBJ) |
| 35 |
$(CC) -o $@ $(OBJ) $(LDFLAGS) |
| 36 |
|
| 37 |
ttf2woff.o: ttf2woff.c ttf2woff.h Makefile |
| 38 |
$(CC) $(CFLAGS) -DVERSION=$(VERSION) -c ttf2woff.c |
| 39 |
|
| 40 |
comp-zopfli.o: comp-zopfli.c ttf2woff.h $(addprefix zopfli/,$(FILES_ZOPFLI)) |
| 41 |
$(CC) $(CFLAGS) -c comp-zopfli.c |
| 42 |
|
| 43 |
rc.o: ttf2woff.rc Makefile |
| 44 |
$(RC) $(DEF) -DVERNUMS=`echo $(VERSION) | sed 's/\\./,/g; s/[^0-9,]//g'` -DVERSION=$(VERSION) -o $@ ttf2woff.rc |
| 45 |
|
| 46 |
install: ttf2woff |
| 47 |
install -s $< $(BINDIR) |
| 48 |
|
| 49 |
clean: |
| 50 |
rm -f ttf2woff $(addsuffix .o,$(basename $(filter %.c,$(FILES_TTF2WOFF)))) |
| 51 |
|
| 52 |
dist: |
| 53 |
ln -s . $(PKG) |
| 54 |
tar czf $(PKG).tar.gz --group=root --owner=root $(addprefix $(PKG)/, $(FILES)); \ |
| 55 |
rm $(PKG) |
| 56 |
|
| 57 |
.PHONY: install clean dist zopfli zopfli.diff |
| 58 |
|
| 59 |
|
| 60 |
# git://github.com/google/zopfli.git |
| 61 |
ZOPFLI_SRC = zopfli-src |
| 62 |
zopfli: $(addprefix $(ZOPFLI_SRC)/src/zopfli/,$(FILES_ZOPFLI)) |
| 63 |
@install -d zopfli |
| 64 |
cp -pf $^ zopfli |
| 65 |
patch -p3 -dzopfli <zopfli.diff |
| 66 |
|
| 67 |
zopfli.diff: |
| 68 |
diff -u --minimal $(ZOPFLI_SRC)/src/zopfli zopfli >$@; true |