summaryrefslogtreecommitdiff
path: root/Makefile
blob: 40955379a4d7d237c2d3260c83c6ba70949b0760 (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
# Makefile for mdns-repeater


ZIP_NAME = mdns-repeater-$(VCSVERSION)

ZIP_FILES = mdns-repeater	\
			README.txt		\
			LICENSE.txt

VCSVERSION=$(shell git describe --dirty="-SNAPSHOT" --always --tags)

CFLAGS=-Wall

ifdef DEBUG
CFLAGS+= -g
else
CFLAGS+= -Os
LDFLAGS+= -s
endif

CFLAGS+= -DVCSVERSION="\"${VCSVERSION}\""

.PHONY: all clean

all: mdns-repeater

mdns-repeater.o: _version

mdns-repeater: mdns-repeater.o

.PHONY: zip
zip: TMPDIR := $(shell mktemp -d)
zip: mdns-repeater
	mkdir $(TMPDIR)/$(ZIP_NAME)
	cp $(ZIP_FILES) $(TMPDIR)/$(ZIP_NAME)
	-$(RM) $(CURDIR)/$(ZIP_NAME).zip
	cd $(TMPDIR) && zip -r $(CURDIR)/$(ZIP_NAME).zip $(ZIP_NAME)
	-$(RM) -rf $(TMPDIR)

# version checking rules
.PHONY: dummy
_version: dummy
	@echo $(VCSVERSION) | cmp -s $@ - || echo $(VCSVERSION) > $@

clean:
	-$(RM) *.o
	-$(RM) _version
	-$(RM) mdns-repeater
	-$(RM) mdns-repeater-*.zip
	-$(RM) build-stamp
	-$(RM) -rf debian/mdns-repeater

install:
	install -d $(DESTDIR)/usr/sbin
	install -d $(DESTDIR)/lib/systemd/system
	install -d $(DESTDIR)/etc/default
	install -m 0755 mdns-repeater $(DESTDIR)/usr/sbin
	install -m 0644 mdns-repeater.service $(DESTDIR)/lib/systemd/system
	install -m 0644 mdns-repeater.default $(DESTDIR)/etc/default/mdns-repeater