aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: cfef4529ef2bd1374f0a6b333f7f83083bcf13a4 (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
CC := gcc

CFLAGS  = -O2 -std=c99 -Wall -W
LDFLAGS =

INSTALL = /usr/bin/env install
PREFIX	= /usr/local

all:
	@echo make run: build voidnsrun.
	@echo make install-run: install voidnsrun to $(PREFIX).
	@echo make undo: build voidnsundo.
	@echo make install-undo: install voidnsundo to $(PREFIX).

test: testserver testclient

run: voidnsrun.o utils.o
	$(CC) $(CFLAGS) -o voidnsrun $^ $(LDFLAGS)

undo: voidnsundo.o utils.o
	$(CC) $(CFLAGS) -o voidnsundo $^ $(LDFLAGS)

testserver: test/testserver.o utils.o
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

testclient: test/testclient.o utils.o
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

install-run: run
	$(INSTALL) voidnsrun $(PREFIX)/bin
	chmod u+s $(PREFIX)/bin/voidnsrun

install-undo: undo
	$(INSTALL) voidnsundo $(PREFIX)/bin
	chmod u+s $(PREFIX)/bin/voidnsundo

clean:
	rm -f *.o test/*.o voidnsrun voidnsundo testserver testclient

%.o: %.c
	$(CC) $(CFLAGS) -c $^ -I. -o $@

.PHONY: all run undo install-run install-undo clean