aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 160ea4aa1db6f4b59f431d5982797d69c21fbb59 (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
# 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}
ifeq ($(SYSTEM_GETOPT),1)
else
	${MAKE} -C getopt-ul
endif

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

${BIN}: ${OBJ}
	${CC} ${LDFLAGS} -o $@ $< ${LIBS}

clean:
	rm -f ${BIN} ${OBJ}
	${MAKE} -C getopt-ul clean

install: all
	for bin in src/* ${BIN} contrib/*; do \
		install -Dm755 $${bin} ${DESTDIR}${BINDIR}/$${bin##*/}; done
	for man in man/*.1; do install -Dm644 $${man} ${DESTDIR}${MAN1}/$${man##*/}; done
	for doc in doc/*; do install -Dm644 $${doc} ${DESTDIR}${CPTDOC}/$${doc##*/}; done
ifeq ($(SYSTEM_GETOPT),1)
else
	${MAKE} -C getopt-ul install
endif

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
	rm -rf ${DESTDIR}${CPTDOC}


.PHONY: all install uninstall clean