annotate Makefile @ 14:6f5c3a02e4d5

filename suffix is now detected in lower or upper case letters
author meillo@marmaro.de
date Sun, 15 Jun 2008 15:50:59 +0200
parents 61ca4934fb34
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
1 # by meillo@marmaro.de
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
2
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
3 NAME=resize-gd
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
4
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
5 # extracts VERSION from the sources
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
6 VERSION=$(shell cat *.c | sed -n '/define[ \t]*VERSION/ s/.*"\([^"]*\)".*/\1/p' )
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
7 NV=${NAME}-${VERSION}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
8
12
61ca4934fb34 improved Makefile
meillo@marmaro.de
parents: 4
diff changeset
9 DOCS = COPYRIGHT ChangeLog
4
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
10
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
11 # paths
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
12 PREFIX = /usr/local
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
13 BINDIR = ${PREFIX}/bin
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
14 MANDIR = ${PREFIX}/share/man
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
15
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
16 # compile env
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
17 CC = gcc
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
18 LD = ${CC}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
19 DEBUG = -g
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
20 LIBS = -lgd
12
61ca4934fb34 improved Makefile
meillo@marmaro.de
parents: 4
diff changeset
21 CFLAGS = -Wall -ansi -pedantic -c ${DEBUG}
61ca4934fb34 improved Makefile
meillo@marmaro.de
parents: 4
diff changeset
22 LDFLAGS = -Wall -ansi -pedantic ${DEBUG} $(LIBS)
4
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
23
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
24 # files
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
25 SRC=resize-gd.c
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
26 OBJ=$(SRC:.c=.o)
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
27 DEP =
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
28
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
29
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
30
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
31 .PHONY: all
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
32 all: options build
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
33
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
34
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
35 .PHONY: options
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
36 options:
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
37 @echo build options:
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
38 @echo "CC = ${CC}"
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
39 @echo "LD = ${LD}"
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
40 @echo "CFLAGS = ${CFLAGS}"
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
41 @echo "LDFLAGS = ${LDFLAGS}"
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
42 @echo
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
43
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
44
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
45 .PHONY: build
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
46 build: options ${NAME}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
47
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
48
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
49 ${NAME}: $(OBJ)
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
50 $(CC) $(LDFLAGS) $(OBJ) -o $@
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
51
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
52
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
53 ${OBJ}: ${DEP}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
54
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
55
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
56 .PHONY: strip
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
57 strip: ${NAME}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
58 @echo stripping ${NAME}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
59 @strip ${NAME}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
60
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
61
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
62 .PHONY: dist
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
63 dist: build changelog
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
64 @echo "generating tarball"
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
65 @mkdir -p ${NV}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
66 @cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
67 @tar -czf ${NV}.tar.gz ${NV}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
68 @rm -rf ${NV}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
69
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
70
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
71 .PHONY: changelog
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
72 changelog:
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
73 @echo generating changelog from mercurial log
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
74 @hg log -v --style changelog > ChangeLog
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
75
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
76
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
77 .PHONY: install
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
78 install: build strip
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
79 @echo installing executable file to ${DESTDIR}${BINDIR}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
80 @mkdir -p ${DESTDIR}${BINDIR}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
81 @cp ${NAME} ${DESTDIR}${BINDIR}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
82 @chmod 755 ${DESTDIR}${BINDIR}/${NAME}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
83 @echo installing manual page to ${DESTDIR}${MANDIR}/man1
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
84 @mkdir -p ${DESTDIR}${MANDIR}/man1
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
85 @cp ${NAME}.1 ${DESTDIR}${MANDIR}/man1/${NAME}.1
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
86 @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
87
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
88
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
89 .PHONY: uninstall
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
90 uninstall:
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
91 @echo removing executable file from ${DESTDIR}${BINDIR}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
92 @rm -f ${DESTDIR}${BINDIR}/${NAME}
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
93 @echo removing manual page from ${DESTDIR}${MANDIR}/man1
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
94 @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
95
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
96
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
97 .PHONY: clean
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
98 clean:
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
99 rm -f *.o
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
100
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
101
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
102 .PHONY: realclean
aa24986b8969 replaces simple Makefile with a good one
meillo@marmaro.de
parents: 0
diff changeset
103 realclean: clean
12
61ca4934fb34 improved Makefile
meillo@marmaro.de
parents: 4
diff changeset
104 rm -f ${NAME}