aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e3cebcfc0dd3d8cef64595cebb05c58d3ec98674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# See LICENSE for copyright information
include config.mk

SRC = bin/cpt-readlink.c bin/cpt-stat.c
OBJ = ${SRC:.c=.o}
BIN = ${SRC:.c=}

all: ${BIN}

.c:
	${CC} ${CFLAGS} ${LDFLAGS} -o $@ $< ${LIBS}

clean:
	rm -f ${BIN} ${OBJ}

install-bin: ${BIN}
	for bin in ${BIN}; do \
		install -Dm755 $${bin} ${DESTDIR}${BINDIR}/$${bin##*/}; done

install-src:
	for bin in src/*; do \
		install -Dm755 $${bin} ${DESTDIR}${BINDIR}/$${bin##*/}; done

install-contrib:
	for bin in contrib/*; do \
		install -Dm755 $${bin} ${DESTDIR}${BINDIR}/$${bin##*/}; done

install-contrib-static:
	mkdir -p ${DESTDIR}${BINDIR}
	for bin in contrib/*; do \
		sed '/\. cpt-lib/r src/cpt-lib' $${bin} | \
		sed '/\. cpt-lib/d' > ${DESTDIR}${BINDIR}/$${bin##*/}; \
		chmod 755 ${DESTDIR}${BINDIR}/$${bin##*/}; done

install-src-static:
	mkdir -p ${DESTDIR}${BINDIR}
	for bin in src/*; do \
		sed '/\. cpt-lib/r src/cpt-lib' $${bin} | \
		sed '/\. cpt-lib/d' > ${DESTDIR}${BINDIR}/$${bin##*/}; \
		chmod 755 ${DESTDIR}${BINDIR}/$${bin##*/}; done

install-doc:
	for man in man/*.1; do install -Dm644 $${man} ${DESTDIR}${MAN1}/$${man##*/}; done

install:        install-bin install-src        install-contrib        install-doc
install-static: install-bin install-src-static install-contrib-static install-doc

uninstall:
	for bin in ${BIN} src/* contrib/*; do \
		rm -f ${DESTDIR}${BINDIR}/$${bin##*/}; done
	for man in man/*; do rm -f ${DESTDIR}${MAN1}/$${man##*/}; done


.PHONY: all install-bin install-src install-contrib install-doc install-src-static install-contrib-static install uninstall test clean