Xinqi Bao's Git

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