resize-gd

view Makefile @ 4:aa24986b8969

replaces simple Makefile with a good one
author meillo@marmaro.de
date Sat, 14 Jun 2008 12:00:23 +0200
parents 8c94239b3b3f
children 61ca4934fb34
line source
1 # by meillo@marmaro.de
3 NAME=resize-gd
5 # extracts VERSION from the sources
6 VERSION=$(shell cat *.c | sed -n '/define[ \t]*VERSION/ s/.*"\([^"]*\)".*/\1/p' )
7 NV=${NAME}-${VERSION}
9 DOCS =
11 # paths
12 PREFIX = /usr/local
13 BINDIR = ${PREFIX}/bin
14 MANDIR = ${PREFIX}/share/man
16 # compile env
17 CC = gcc
18 LD = ${CC}
19 DEBUG = -g
20 LIBS = -lgd
21 CFLAGS = -Wall -pedantic -c ${DEBUG}
22 LDFLAGS = -Wall -pedantic ${DEBUG} $(LIBS)
24 # files
25 SRC=resize-gd.c
26 OBJ=$(SRC:.c=.o)
27 DEP =
31 .PHONY: all
32 all: options build
35 .PHONY: options
36 options:
37 @echo build options:
38 @echo "CC = ${CC}"
39 @echo "LD = ${LD}"
40 @echo "CFLAGS = ${CFLAGS}"
41 @echo "LDFLAGS = ${LDFLAGS}"
42 @echo
45 .PHONY: build
46 build: options ${NAME}
49 ${NAME}: $(OBJ)
50 $(CC) $(LDFLAGS) $(OBJ) -o $@
53 ${OBJ}: ${DEP}
56 .PHONY: strip
57 strip: ${NAME}
58 @echo stripping ${NAME}
59 @strip ${NAME}
62 .PHONY: dist
63 dist: build changelog
64 @echo "generating tarball"
65 @mkdir -p ${NV}
66 @cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
67 @tar -czf ${NV}.tar.gz ${NV}
68 @rm -rf ${NV}
71 .PHONY: changelog
72 changelog:
73 @echo generating changelog from mercurial log
74 @hg log -v --style changelog > ChangeLog
77 .PHONY: install
78 install: build strip
79 @echo installing executable file to ${DESTDIR}${BINDIR}
80 @mkdir -p ${DESTDIR}${BINDIR}
81 @cp ${NAME} ${DESTDIR}${BINDIR}
82 @chmod 755 ${DESTDIR}${BINDIR}/${NAME}
83 @echo installing manual page to ${DESTDIR}${MANDIR}/man1
84 @mkdir -p ${DESTDIR}${MANDIR}/man1
85 @cp ${NAME}.1 ${DESTDIR}${MANDIR}/man1/${NAME}.1
86 @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
89 .PHONY: uninstall
90 uninstall:
91 @echo removing executable file from ${DESTDIR}${BINDIR}
92 @rm -f ${DESTDIR}${BINDIR}/${NAME}
93 @echo removing manual page from ${DESTDIR}${MANDIR}/man1
94 @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
97 .PHONY: clean
98 clean:
99 rm -f *.o
102 .PHONY: realclean
103 realclean: clean
104 rm -f ${NAME} ChangeLog