summaryrefslogtreecommitdiff
path: root/Makefile
blob: c50e596271f690b74ca12508922e26f392600d66 (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
CFLAGS ?= -O2
PREFIX ?= /usr/local

VERSION ?= 2.0.4-git

CFLAGS += -Wall -Wextra -pedantic

sysdir = ${DESTDIR}${PREFIX}

bin/envstore: src/envstore.c
	${CC} -DVERSION=\"${VERSION}\" ${CFLAGS} ${LDFLAGS} -o $@ $<

install: bin/envstore
	@echo installing:
	@echo 'envstore   to ${sysdir}/bin'
	@echo 'envify     to ${sysdir}/bin'
	@echo 'envstore.1 to ${sysdir}/share/man/man1'
	@echo 'envify.1   to ${sysdir}/share/man/man1'
	@mkdir -p ${sysdir}/bin ${sysdir}/share/man/man1
	@cp bin/envstore ${sysdir}/bin/envstore
	@cp bin/envify ${sysdir}/bin/envify
	@cp man/1/envify ${sysdir}/share/man/man1/envify.1
	@cp man/1/envstore ${sysdir}/share/man/man1/envstore.1
	@chmod 755 ${sysdir}/bin/envstore
	@chmod 755 ${sysdir}/bin/envify
	@chmod 644 ${sysdir}/share/man/man1/envify.1
	@chmod 644 ${sysdir}/share/man/man1/envstore.1

uninstall:
	rm -f ${sysdir}/bin/envstore ${sysdir}/bin/envify
	rm -f ${sysdir}/share/man/man1/envify.1
	rm -f ${sysdir}/share/man/man1/envstore.1

test:
	test/main

clean:
	rm -f bin/envstore

.PHONY: all install uninstall test clean