summaryrefslogtreecommitdiff
path: root/Makefile
blob: eb7d1f48e11891e1b6252d21d919c27457aa3a78 (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
55
56
# xml2tsv - simple xml-to-tsv converter 
.POSIX:

include config.mk

SRC = xml.c xml2tsv.c 
INC = config.h xml.h 
OBJ = ${SRC:.c=.o}
MAN1 = xml2tsv.1
DISTFILES = ${SRC} ${INC} Makefile config.mk ${MAN1}

all: options xml2tsv

options:
	@echo "-+- build options -+-"
	@echo "PREFIX  = ${PREFIX}"
	@echo "CFLAGS  = ${CFLAGS}"
	@echo "LDFLAGS = ${LDFLAGS}"
	@echo "CC      = ${CC}"
	@echo "-+-+-+-+-+-+-+-+-+-+-" 

xml2tsv: ${OBJ}
	$(CC) $(LDFLAGS) -o $@ $(OBJ)

${OBJ}: ${INC}

debug: clean
	${MAKE} CFLAGS="${DEBUG}" all

clean:
	rm -f xml2tsv ${OBJ}

install: all
	# installing executable to ${DESTDIR}${BINDIR}
	mkdir -p "${DESTDIR}${BINDIR}"
	cp -f xml2tsv "${DESTDIR}${BINDIR}"
	chmod 755 "${DESTDIR}${BINDIR}/xml2tsv"
	# installing man page to ${DESTDIR}${MANPREFIX}
	mkdir -p ${DESTDIR}${MANPREFIX}/man1
	cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
	for f in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$f; done

uninstall:
	# removing executable file from ${DESTDIR}${BINDIR}
	rm -f "${DESTDIR}${BINDIR}/xml2tsv"
	# removing man pages ${DESTDIR}${MANPREFIX}
	for f in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$f; done

dist: clean
	# make a tarball
	mkdir -p ./xml2tsv-${VERSION}
	rm -rf ./xml2tsv-${VERSION}/*
	cp -R ${DISTFILES} ./xml2tsv-${VERSION}/
	tar -cf xml2tsv-${VERSION}.tar ./xml2tsv-${VERSION}
	gzip xml2tsv-${VERSION}.tar
	rm -rf xml2tsv-${VERSION}