-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 1.17 KB
/
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
50
#CXXFLAGS = -Wall -Wextra -g -Os
CXXFLAGS = -Wall -Wextra -g
#-march=i486 -mtune=i686 -Os
LDFLAGS=-Wl,-O1
SUBDIRS = sample
all: powermatempd pmtrace subdirs
LIBOBJS = powermate.o mpd.o powermatempd.o log.o
OBJS = $(LIBOBJS) main.o pmtrace.o
HEADERS = powermate.h mpd.h powermatempd.h hgversion.h log.h
$(OBJS) : $(HEADERS)
powermatempd: $(LIBOBJS) main.o
$(CXX) $^ -o $@ -lmpdclient
pmtrace: $(LIBOBJS) pmtrace.o
$(CXX) $^ -o $@ -lmpdclient
.PHONY : subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS) :
$(MAKE) -C $@
cleanall : clean cleansubs
clean :
rm -f *.o *~ powermatempd pmtrace
cleansubs :
$(MAKE) -C $(SUBDIRS) clean
#
# Generate hgversion.h
# Verify that it has changed before moving the new copy in place.
#
.PHONY : hgversion
hgversion :
hgversion.h : hgversion
@ echo "namespace HgVersion { ;" > hgversion.h.tmp
@ echo "static const char* const hash = \"$$(hg id --id)\";" >> hgversion.h.tmp
@ echo "static const char* const revision = \"$$(hg id --num)\";" >> hgversion.h.tmp
@ echo "}" >> hgversion.h.tmp
@ cmp -s hgversion.h.tmp hgversion.h || mv -f hgversion.h.tmp hgversion.h
@ [[ -e hgversion.h.tmp ]] || echo "Generated hgversion.h"
@ rm -f hgversion.h.tmp