allow buttonrelease customization in config.h
[surf.git] / Makefile
1 # surf - simple browser
2 # See LICENSE file for copyright and license details.
3
4 include config.mk
5
6 SRC = surf.c
7 OBJ = ${SRC:.c=.o}
8
9 all: options surf
10
11 options:
12         @echo surf build options:
13         @echo "CFLAGS   = ${CFLAGS}"
14         @echo "LDFLAGS  = ${LDFLAGS}"
15         @echo "CC       = ${CC}"
16
17 .c.o:
18         @echo CC $<
19         @${CC} -c ${CFLAGS} $<
20
21 ${OBJ}: config.h config.mk
22
23 config.h:
24         @echo creating $@ from config.def.h
25         @cp config.def.h $@
26
27 surf: ${OBJ}
28         @echo CC -o $@
29         @${CC} -o $@ surf.o ${LDFLAGS}
30
31 clean:
32         @echo cleaning
33         @rm -f surf ${OBJ} surf-${VERSION}.tar.gz
34
35 dist: clean
36         @echo creating dist tarball
37         @mkdir -p surf-${VERSION}
38         @cp -R LICENSE Makefile config.mk config.def.h README \
39                 surf-open.sh arg.h TODO.md surf.png \
40                 surf.1 ${SRC} surf-${VERSION}
41         @tar -cf surf-${VERSION}.tar surf-${VERSION}
42         @gzip surf-${VERSION}.tar
43         @rm -rf surf-${VERSION}
44
45 install: all
46         @echo installing executable file to ${DESTDIR}${PREFIX}/bin
47         @mkdir -p ${DESTDIR}${PREFIX}/bin
48         @cp -f surf ${DESTDIR}${PREFIX}/bin
49         @chmod 755 ${DESTDIR}${PREFIX}/bin/surf
50         @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
51         @mkdir -p ${DESTDIR}${MANPREFIX}/man1
52         @sed "s/VERSION/${VERSION}/g" < surf.1 > ${DESTDIR}${MANPREFIX}/man1/surf.1
53         @chmod 644 ${DESTDIR}${MANPREFIX}/man1/surf.1
54
55 uninstall:
56         @echo removing executable file from ${DESTDIR}${PREFIX}/bin
57         @rm -f ${DESTDIR}${PREFIX}/bin/surf
58         @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
59         @rm -f ${DESTDIR}${MANPREFIX}/man1/surf.1
60
61 .PHONY: all options clean dist install uninstall