forked from kornelski/pngquant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (56 loc) · 2.08 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
-include config.mk
LIQSRCDIR ?= lib
BIN ?= pngquant
BINPREFIX ?= $(DESTDIR)$(PREFIX)/bin
MANPREFIX ?= $(DESTDIR)$(PREFIX)/share/man
OBJS = pngquant.o pngquant_opts.o rwpng.o
STATICLIB = $(LIQSRCDIR)/libimagequant.a
DISTFILES = *.[chm] pngquant.1 Makefile configure README.md INSTALL CHANGELOG COPYRIGHT Cargo.toml
TARNAME = pngquant-$(VERSION)
TARFILE = $(TARNAME)-src.tar.gz
LIBDISTFILES = $(LIQSRCDIR)/*.[ch] $(LIQSRCDIR)/COPYRIGHT $(LIQSRCDIR)/README.md $(LIQSRCDIR)/configure $(LIQSRCDIR)/Makefile $(LIQSRCDIR)/Cargo.toml
TESTBIN = test/test
all: $(BIN)
$(LIQSRCDIR)/config.mk: config.mk
( cd '$(LIQSRCDIR)'; ./configure $(LIQCONFIGUREFLAGS) )
$(STATICLIB): $(LIQSRCDIR)/config.mk $(LIBDISTFILES)
$(MAKE) -C '$(LIQSRCDIR)' static
$(OBJS): $(wildcard *.h) config.mk
$(BIN): $(OBJS) $(STATICLIBDEPS)
$(CC) $(OBJS) $(CFLAGS) $(LDFLAGS) -o $@
$(TESTBIN): test/test.o $(STATICLIBDEPS)
$(CC) test/test.o $(CFLAGS) $(LDFLAGS) -o $@
test: $(BIN) $(TESTBIN)
LD_LIBRARY_PATH='$(LIQSRCDIR)' ./test/test.sh ./test $(BIN) $(TESTBIN)
dist: $(TARFILE)
$(TARFILE): $(DISTFILES)
rm -rf $(TARFILE) $(TARNAME)
mkdir -p $(TARNAME)/lib/rust $(TARNAME)/lib/msvc-dist $(TARNAME)/rust
cp $(DISTFILES) $(TARNAME)
cp rust/*.rs $(TARNAME)/rust/
cp $(LIBDISTFILES) $(TARNAME)/lib
cp lib/rust/*.rs $(TARNAME)/lib/rust/
cp lib/msvc-dist/*.[ch] $(TARNAME)/lib/msvc-dist/
tar -czf $(TARFILE) --numeric-owner --exclude='._*' $(TARNAME)
rm -rf $(TARNAME)
-shasum $(TARFILE)
install: $(BIN) $(BIN).1
-mkdir -p '$(BINPREFIX)'
-mkdir -p '$(MANPREFIX)/man1'
install -m 0755 -p '$(BIN)' '$(BINPREFIX)/$(BIN)'
install -m 0644 -p '$(BIN).1' '$(MANPREFIX)/man1/'
uninstall:
rm -f '$(BINPREFIX)/$(BIN)'
rm -f '$(MANPREFIX)/man1/$(BIN).1'
clean:
-test -n '$(LIQSRCDIR)' && $(MAKE) -C '$(LIQSRCDIR)' clean
rm -f '$(BIN)' $(OBJS) $(TARFILE)
distclean: clean
-test -n '$(LIQSRCDIR)' && $(MAKE) -C '$(LIQSRCDIR)' distclean
rm -f config.mk pngquant-*-src.tar.gz
config.mk: Makefile
ifeq ($(filter %clean %distclean, $(MAKECMDGOALS)), )
./configure
endif
.PHONY: all clean dist distclean dll install uninstall test
.DELETE_ON_ERROR: