forked from gfto/mptsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (54 loc) · 1.49 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
56
57
58
59
60
61
62
63
64
65
66
67
68
CC = $(CROSS)$(TARGET)gcc
STRIP = $(CROSS)$(TARGET)strip
BUILD_ID = $(shell date +%F_%R)
VERSION="v1.1"
GIT_VER = $(shell git describe --tags --dirty --always 2>/dev/null)
CFLAGS = -ggdb -Wall -Wextra -Wshadow -Wformat-security -Wno-strict-aliasing -O2 -D_GNU_SOURCE -DBUILD_ID=\"$(BUILD_ID)\"
ifneq "$(GIT_VER)" ""
CFLAGS += -DGIT_VER=\"$(GIT_VER)\"
else
CFLAGS += -DGIT_VER=\"$(VERSION)\"
endif
RM = /bin/rm -f
Q = @
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifeq ($(uname_S),Darwin)
LIBS = -lpthread -lm
else
LIBS = -lpthread -lm -lrt
endif
FUNCS_DIR = libfuncs
FUNCS_LIB = $(FUNCS_DIR)/libfuncs.a
TSFUNCS_DIR = libtsfuncs
TSFUNCS_LIB = $(TSFUNCS_DIR)/libtsfuncs.a
mptsd_OBJS = $(FUNCS_LIB) $(TSFUNCS_LIB) \
iniparser.o inidict.o pidref.o data.o config.o \
sleep.o network.o \
input.o \
output_psi.o output_mix.o output_write.o \
web_pages.o web_server.o \
mptsd.o
PROGS = mptsd
CLEAN_OBJS = $(PROGS) $(mptsd_OBJS) *~
all: $(PROGS)
$(FUNCS_LIB):
$(Q)echo " MAKE $(FUNCS_LIB)"
$(Q)$(MAKE) -s -C $(FUNCS_DIR)
$(TSFUNCS_LIB):
$(Q)echo " MAKE $(TSFUNCS_LIB)"
$(Q)$(MAKE) -s -C $(TSFUNCS_DIR)
mptsd: $(mptsd_OBJS)
$(Q)echo " LINK mptsd"
$(Q)$(CC) $(CFLAGS) $(mptsd_OBJS) $(LIBS) -o mptsd
%.o: %.c data.h
$(Q)echo " CC mptsd $<"
$(Q)$(CC) $(CFLAGS) -c $<
strip:
$(Q)echo " STRIP $(PROGS)"
$(Q)$(STRIP) $(PROGS)
clean:
$(Q)echo " RM $(CLEAN_OBJS)"
$(Q)$(RM) $(CLEAN_OBJS)
distclean: clean
$(Q)$(MAKE) -s -C $(TSFUNCS_DIR) clean
$(Q)$(MAKE) -s -C $(FUNCS_DIR) clean