-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
61 lines (47 loc) · 1.28 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
PNAME = jpeg-recompress
CC ?= gcc
CFLAGS += -std=c99 -Wall -O3
LIBIQA = -liqa
LIBSFRY = -lsmallfry
LIBJPEG = -ljpeg
LIBWEBP = -lwebp
LIBIMM = jmetrics.a
LDFLAGS += -lm $(LIBJPEG) $(LIBIQA) $(LIBSFRY)
PROGR = jpeg-recompress
PROGC = jpeg-compare
PROGH = jpeg-hash
PROGZ = jpeg-zfpoint
PROGW = webp-compress
PROGS = $(PROGR) $(PROGC) $(PROGH) $(PROGZ) $(PROGW)
PREFIX ?= /usr/local
MAKE ?= make
AR ?= ar
RM ?= rm
INSTALL = install
LIBOBJ = src/jmetrics.o
.PHONY: test clean install uninstall
all: $(PROGS)
$(LIBIMM): $(LIBOBJ)
$(AR) crs $@ $^
$(PROGR): src/$(PROGR).c $(LIBIMM)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(PROGC): src/$(PROGC).c $(LIBIMM)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(PROGH): src/$(PROGH).c $(LIBIMM)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(PROGZ): src/$(PROGZ).c $(LIBIMM)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
$(PROGW): src/$(PROGW).c $(LIBIMM)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBWEBP)
%.o: %.c %.h
$(CC) $(CFLAGS) -c -o $@ $<
test: test/test.c $(LIBIMM)
$(CC) $(CFLAGS) -o test/$@ $^ $(LDFLAGS)
./test/$@
clean:
$(RM) -rf $(PROGS) $(LIBIMM) $(LIBOBJ) test/test
install: all
$(INSTALL) -d $(PREFIX)/bin
$(INSTALL) -m 0755 $(PROGS) $(PREFIX)/bin/
uninstall:
$(RM) -f $(PREFIX)/bin/$(PROGR) $(PREFIX)/bin/$(PROGC) $(PREFIX)/bin/$(PROGH) $(PREFIX)/bin/$(PROGZ)