| 1 |
# Sample makefile for pngcrush using gcc and GNU make. |
| 2 |
# Glenn Randers-Pehrson |
| 3 |
# Last modified: 25 February 2010 |
| 4 |
# |
| 5 |
# Invoke this makefile from a shell prompt in the usual way; for example: |
| 6 |
# |
| 7 |
# make -f Makefile.solaris |
| 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 zlib: |
| 14 |
ZINC = /usr/local/include |
| 15 |
ZLIB = /usr/local/lib |
| 16 |
|
| 17 |
CC = gcc |
| 18 |
LD = gcc |
| 19 |
RM = rm -f |
| 20 |
#CFLAGS = -I. -O -Wall |
| 21 |
#CFLAGS = -I. -O3 -fomit-frame-pointer -Wall |
| 22 |
CFLAGS = -I${ZINC} -I. -O3 -fomit-frame-pointer -Wall |
| 23 |
# [note that -Wall is a gcc-specific compilation flag ("all warnings on")] |
| 24 |
LDFLAGS = |
| 25 |
O = .o |
| 26 |
E = |
| 27 |
|
| 28 |
PNGCRUSH = pngcrush |
| 29 |
|
| 30 |
# LIBS = -lm |
| 31 |
LIBS = -L/usr/local/lib -lpng -lz -lm |
| 32 |
# LIBS = -L${ZLIB} -lz -lm |
| 33 |
#LIBS = ${ZLIB}/libz.a -lm |
| 34 |
|
| 35 |
# uncomment these 4 lines only if you are NOT using an external copy of zlib: |
| 36 |
# ZHDR = zlib.h |
| 37 |
# ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \ |
| 38 |
# infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ |
| 39 |
# trees$(O) uncompr$(O) zutil$(O) |
| 40 |
|
| 41 |
OBJS = pngcrush$(O) |
| 42 |
# png$(O) pngerror$(O) pngget$(O) pngmem$(O) \ |
| 43 |
# pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \ |
| 44 |
# pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \ |
| 45 |
# pngwtran$(O) pngwutil$(O) $(ZOBJS) |
| 46 |
|
| 47 |
EXES = $(PNGCRUSH)$(E) |
| 48 |
|
| 49 |
|
| 50 |
# implicit make rules ------------------------------------------------------- |
| 51 |
|
| 52 |
.c$(O): cexcept.h |
| 53 |
$(CC) -c $(CFLAGS) $< |
| 54 |
#.c$(O): png.h pngconf.h pngcrush.h cexcept.h pngpriv.h $(ZHDR) |
| 55 |
# $(CC) -c $(CFLAGS) $< |
| 56 |
|
| 57 |
|
| 58 |
# dependencies -------------------------------------------------------------- |
| 59 |
|
| 60 |
all: $(EXES) |
| 61 |
|
| 62 |
|
| 63 |
pngcrush$(O): pngcrush.c cexcept.h |
| 64 |
$(CC) -c $(CFLAGS) $< |
| 65 |
# pngcrush$(O): pngcrush.c png.h pngconf.h pngcrush.h cexcept.h $(ZHDR) |
| 66 |
# $(CC) -c $(CFLAGS) $< |
| 67 |
|
| 68 |
$(PNGCRUSH)$(E): $(OBJS) |
| 69 |
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) |
| 70 |
|
| 71 |
# maintenance --------------------------------------------------------------- |
| 72 |
|
| 73 |
clean: |
| 74 |
$(RM) $(EXES) $(OBJS) |