| 1 |
# Sample makefile for pngcrush using gcc and GNU make. |
| 2 |
# Glenn Randers-Pehrson |
| 3 |
# Last modified: 19 February 2005 |
| 4 |
# |
| 5 |
# Invoke this makefile from a shell prompt in the usual way; for example: |
| 6 |
# |
| 7 |
# make -f makefile.gcc |
| 8 |
# |
| 9 |
# This makefile builds a dynamically linked executable. |
| 10 |
|
| 11 |
# macros -------------------------------------------------------------------- |
| 12 |
|
| 13 |
# uncomment these 2 lines only if you are using an external copy of libpng: |
| 14 |
PNGINC = /usr/local/include |
| 15 |
PNGLIB = /usr/local/lib |
| 16 |
# uncomment these 2 lines only if you are using an external copy of zlib: |
| 17 |
ZINC = /usr/local/include |
| 18 |
ZLIB = /usr/local/lib |
| 19 |
|
| 20 |
CC = gcc |
| 21 |
LD = gcc |
| 22 |
RM = rm -f |
| 23 |
|
| 24 |
CPPFLAGS = -I $(PNGINC) |
| 25 |
|
| 26 |
CFLAGS = -g -O3 -fomit-frame-pointer -Wall |
| 27 |
# [note that -Wall is a gcc-specific compilation flag ("all warnings on")] |
| 28 |
LDFLAGS = |
| 29 |
O = .o |
| 30 |
E = |
| 31 |
|
| 32 |
PNGCRUSH = pngcrush |
| 33 |
|
| 34 |
LIBS = -L$(PNGLIB) -L$(ZLIB) -lpng -lz -lm |
| 35 |
|
| 36 |
OBJS = pngcrush$(O) |
| 37 |
|
| 38 |
EXES = $(PNGCRUSH)$(E) |
| 39 |
|
| 40 |
# implicit make rules ------------------------------------------------------- |
| 41 |
|
| 42 |
.c$(O): cexcept.h $(ZHDR) |
| 43 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< |
| 44 |
|
| 45 |
# dependencies -------------------------------------------------------------- |
| 46 |
|
| 47 |
|
| 48 |
all: $(EXES) |
| 49 |
|
| 50 |
pngcrush$(O): pngcrush.c cexcept.h |
| 51 |
touch png.h |
| 52 |
mv png.h png.h_embedded |
| 53 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< |
| 54 |
mv png.h_embedded png.h |
| 55 |
|
| 56 |
$(PNGCRUSH)$(E): $(OBJS) |
| 57 |
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) |
| 58 |
|
| 59 |
# maintenance --------------------------------------------------------------- |
| 60 |
|
| 61 |
clean: |
| 62 |
$(RM) $(EXES) $(OBJS) |
| 63 |
|
| 64 |
install: |
| 65 |
mkdir -p $(DESTDIR)/usr/bin/ |
| 66 |
cp $(PNGCRUSH)$(E) $(DESTDIR)/usr/bin/ |
| 67 |
chmod 0755 $(DESTDIR)/usr/bin/$(PNGCRUSH)$(E) |
| 68 |
|