-
Notifications
You must be signed in to change notification settings - Fork 59
/
Makefile
50 lines (35 loc) · 847 Bytes
/
Makefile
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
# Makefile for mdns-repeater
ZIP_NAME = mdns-repeater-$(HGVERSION)
ZIP_FILES = mdns-repeater \
README.txt \
LICENSE.txt
HGVERSION=$(shell git rev-parse HEAD )
CFLAGS=-Wall
ifdef DEBUG
CFLAGS+= -g
else
CFLAGS+= -Os
LDFLAGS+= -s
endif
CFLAGS+= -DHGVERSION="\"${HGVERSION}\""
.PHONY: all clean
all: mdns-repeater
mdns-repeater.o: _hgversion
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
_hgversion: dummy
@echo $(HGVERSION) | cmp -s $@ - || echo $(HGVERSION) > $@
clean:
-$(RM) *.o
-$(RM) _hgversion
-$(RM) mdns-repeater
-$(RM) mdns-repeater-*.zip