-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
56 lines (36 loc) · 1.28 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
51
52
53
54
55
VERSION = 0.0.2c
LIBFILE = libdbus2vdr.a
CC ?= gcc
AR ?= ar
CFLAGS ?= -g -O3 -Wall
DEFINES = -D_GNU_SOURCE
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
CFLAGS += $(shell pkg-config --cflags glib-2.0 gio-unix-2.0)
XMLS = $(wildcard *.xml)
HEADERS = $(patsubst %.xml,%.h,$(XMLS))
CODES = $(patsubst %.xml,%.c,$(XMLS))
OBJS = $(patsubst %.xml,%.o,$(XMLS))
all: $(LIBFILE)
%.o: %.c
$(CC) $(CFLAGS) -c $(DEFINES) -o $@ $<
%.h: %.xml
gdbus-codegen --generate-c-code `basename $< .xml` --interface-prefix de.tvdr.vdr --c-namespace DBus2vdr $<
MAKEDEP = $(CC) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile $(HEADERS)
@-rm -f $(DEPFILE)
for x in $(XMLS); do echo "`basename $$x .xml`.h: $$x" >> $@; done
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) >> $@
-include $(DEPFILE)
$(LIBFILE): $(OBJS)
$(AR) rcs $@ $(OBJS)
install-includes:
@mkdir -p $(DESTDIR)/usr/include/libdbus2vdr
@cp *.h $(DESTDIR)/usr/include/libdbus2vdr
install-lib: $(LIBFILE)
install -D $^ $(DESTDIR)/usr/lib/$^
install: install-includes install-lib
clean:
@-rm -f $(OBJS) $(DEPFILE) $(HEADERS) $(CODES) $(LIBFILE) *.tgz core* *~
orig: clean
if [ -d .git ]; then git archive --format=tar.gz --prefix=libdbus2vdr-$(VERSION)/ -o ../libdbus2vdr_$(VERSION).orig.tar.gz master; fi