aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 69ad4efeeb4073ddc20515298c37d62130312b43 (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
57
58
59
60
.POSIX:
.SUFFIXES:

CC = cc
CFLAGS = -Wall -O2
CFLAGSDEBUG = -std=c99 -Wall -pedantic -ggdb3 -O0 -DDEBUG
PREFIX = /usr/local

all: every

debug: dbg_every

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1
	cp -f every $(DESTDIR)$(PREFIX)/bin
	gzip < every.1 > $(DESTDIR)$(PREFIX)/share/man/man1/every.1.gz

every: build/release build/release/calendar.o build/release/opt.o build/release/main.o
	$(CC) $(LDFLAGS) -o every build/release/calendar.o build/release/opt.o build/release/main.o $(LDLIBS)

dbg_every: build/debug build/debug/calendar.o build/debug/opt.o build/debug/main.o
	$(CC) $(LDFLAGS) -o dbg_every build/debug/calendar.o build/debug/opt.o build/debug/main.o $(LDLIBS)

build/release:
	mkdir -p build/release

build/debug:
	mkdir -p build/debug

src/version.h:
	printf "%s\n%s\n\n%s%s%s\n\n%s\n" \
		"#ifndef EVERY_VERSION_H" \
		"#define EVERY_VERSION_H" \
		"#define VERSION \"every-" "47b6e46" "\"" \
		"#endif" > src/version.h

build/release/calendar.o: src/calendar.c
	$(CC) -c $(CFLAGS) -o build/release/calendar.o src/calendar.c
build/release/opt.o: src/opt.c src/version.h src/opt.h \
 src/../reqs/simple-opt/simple-opt.h
	$(CC) -c $(CFLAGS) -o build/release/opt.o src/opt.c
build/release/main.o: src/main.c src/opt.h \
 src/../reqs/simple-xdg-bdirs/simple-xdg-bdirs.h
	$(CC) -c $(CFLAGS) -o build/release/main.o src/main.c

build/debug/calendar.o: src/calendar.c
	$(CC) -c $(CFLAGSDEBUG) -o build/debug/calendar.o src/calendar.c
build/debug/opt.o: src/opt.c src/version.h src/opt.h \
 src/../reqs/simple-opt/simple-opt.h
	$(CC) -c $(CFLAGSDEBUG) -o build/debug/opt.o src/opt.c
build/debug/main.o: src/main.c src/opt.h \
 src/../reqs/simple-xdg-bdirs/simple-xdg-bdirs.h
	$(CC) -c $(CFLAGSDEBUG) -o build/debug/main.o src/main.c

clean:
	rm -f src/version.h
	rm -f every
	rm -f dbg_every
	rm -rf build