Line 0
Link Here
|
|
|
1 |
# Sample makefile for pngcrush using gcc and GNU make. |
2 |
# Glenn Randers-Pehrson |
3 |
# Last modified: 19 February 2005 |
4 |
# Kapil Hari Paranjape |
5 |
# Last modified: 12 June 2008 |
6 |
# |
7 |
# Invoke this makefile from a shell prompt in the usual way; for example: |
8 |
# |
9 |
# make -f Makefile |
10 |
# |
11 |
# This makefile builds a dynamically linked executable. |
12 |
|
13 |
# macros -------------------------------------------------------------------- |
14 |
|
15 |
GAS_VERSION := $(shell as --version | sed -n -e's/GNU assembler (.*) //p') |
16 |
|
17 |
PNGINC = /usr/include |
18 |
|
19 |
CC ?= gcc |
20 |
RM = rm -f |
21 |
|
22 |
CFLAGS += -I. -Wall |
23 |
|
24 |
O = .o |
25 |
E = |
26 |
|
27 |
# additional defines |
28 |
DEFINES = -DPNG_USE_PNGGCCRD -DPNG_iCCP_SUPPORTED \ |
29 |
-DPNG_iTXt_SUPPORTED -DPNG_USE_GLOBAL_ARRAYS \ |
30 |
-DGAS_VERSION="\"${GAS_VERSION}\"" \ |
31 |
|
32 |
PNGCRUSH = pngcrush |
33 |
|
34 |
LIBS = -lpng -lz |
35 |
|
36 |
OBJS = pngcrush$(O) |
37 |
|
38 |
EXES = $(PNGCRUSH)$(E) |
39 |
|
40 |
|
41 |
# implicit make rules ------------------------------------------------------- |
42 |
|
43 |
.c$(O): png.h cexcept.h $(ZHDR) |
44 |
$(CC) -c $(CFLAGS) $(DEFINES) $< |
45 |
|
46 |
|
47 |
# dependencies -------------------------------------------------------------- |
48 |
|
49 |
all: $(EXES) |
50 |
|
51 |
png.h: |
52 |
ln -s $(PNGINC)/png.h png.h |
53 |
|
54 |
pngcrush$(O): pngcrush.c cexcept.h |
55 |
$(CC) -c $(CFLAGS) $(DEFINES) $< |
56 |
|
57 |
$(PNGCRUSH)$(E): $(OBJS) |
58 |
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) |
59 |
|
60 |
# maintenance --------------------------------------------------------------- |
61 |
|
62 |
clean: |
63 |
$(RM) $(EXES) $(OBJS) png.h |
64 |
|
65 |
install: |
66 |
mkdir -p $(DESTDIR)/usr/bin/ |
67 |
cp $(PNGCRUSH)$(E) $(DESTDIR)/usr/bin/ |
68 |
chmod 0755 $(DESTDIR)/usr/bin/$(PNGCRUSH)$(E) |
69 |
|