forked from cschil/mcm-deamon
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
46 lines (35 loc) · 1.02 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
ifeq ($(DEB_HOST_GNU_TYPE),)
CC ?= gcc
AR ?= ar
STRIP ?= strip
else
CC = $(DEB_HOST_GNU_TYPE)-gcc
AR = $(DEB_HOST_GNU_TYPE)-ar
STRIP = $(DEB_HOST_GNU_TYPE)-strip
endif
CFLAGS += -Wall -I. -Iiniparser/src -I/usr/include
LIBS +=-Liniparser -liniparser
DEPS = mcm.h iniparser/src/iniparser.h
OBJ = mcm-daemon.o
INSTALL = install
ETC_DIR=$(DESTDIR)/etc
SYS_DIR=$(DESTDIR)/etc/systemd/system/
BIN_DIR=$(DESTDIR)/sbin
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
mcm-daemon: $(OBJ) iniparser/libiniparser.a
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
iniparser/libiniparser.a: iniparser
make -C iniparser CC=$(CC) AR=$(AR) STRIP=$(STRIP)
iniparser/src/iniparser.h:
git clone http://github.com/ndevilla/iniparser
clean:
@sh -c "[ -d iniparser ] && make -C iniparser veryclean || true"
rm -f *.o mcm-daemon
install:
$(INSTALL) -d $(ETC_DIR)
$(INSTALL) -d $(SYS_DIR)
$(INSTALL) -d $(BIN_DIR)
$(INSTALL) -t $(ETC_DIR) mcm-daemon.ini
$(INSTALL) -t $(SYS_DIR) mcm-daemon.service
$(INSTALL) -t $(BIN_DIR) mcm-daemon