forked from community-ssu/dsme
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
128 lines (101 loc) · 3.69 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#
# Build targets
#
BINARIES := dsme dsme-server dsme-exec-helper
SUBDIRS := util modules
VERSION := 0.60.48
#
# Install files in this directory
#
INSTALL_PERM := 644
INSTALL_OWNER := $(shell id -u)
INSTALL_GROUP := $(shell id -g)
INSTALL_BINARIES := dsme dsme-server dsme-exec-helper
$(INSTALL_BINARIES) : INSTALL_PERM := 755
$(INSTALL_BINARIES) : INSTALL_DIR := $(DESTDIR)/sbin
INSTALL_INCLUDES := include/dsme/dsme-cal.h \
include/dsme/dsmesock.h \
include/dsme/logging.h \
include/dsme/mainloop.h \
include/dsme/modulebase.h \
include/dsme/modules.h \
include/dsme/oom.h \
include/dsme/timers.h \
dsme-wdd-wd.h
$(INSTALL_INCLUDES) : INSTALL_DIR := $(DESTDIR)/usr/include/dsme
#
# Compiler and tool flags
# C_OPTFLAGS are not used for debug builds (ifdef DEBUG)
# C_DBGFLAGS are not used for normal builds
#
C_GENFLAGS := -DPRG_VERSION=$(VERSION) -pthread -g -std=c99 \
-Wall -Wwrite-strings -Wmissing-prototypes -Werror# -pedantic
C_OPTFLAGS := -O2 -s
C_DBGFLAGS := -g -DDEBUG -DDSME_LOG_ENABLE
C_DEFINES := DSME_POSIX_TIMER DSME_WD_SYNC DSME_BMEIPC
C_INCDIRS := $(TOPDIR)/include $(TOPDIR)/modules $(TOPDIR)
MKDEP_INCFLAGS := $$(pkg-config --cflags-only-I glib-2.0)
LD_GENFLAGS := -pthread
# If OSSO_DEBUG is defined, compile in the logging
#ifdef OSSO_LOG
C_OPTFLAGS += -DDSME_LOG_ENABLE
#endif
ifneq (,$(findstring DSME_BMEIPC,$(C_DEFINES)))
export DSME_BMEIPC = yes
endif
ifneq (,$(findstring DSME_MEMORY_THERMAL_MGMT,$(C_DEFINES)))
export DSME_MEMORY_THERMAL_MGMT = yes
endif
#
# Target composition and overrides
#
# dsme
dsme_C_OBJS := dsme-wdd.o dsme-wdd-wd.o oom.o
dsme: C_OPTFLAGS := -O2 -s
dsme: C_GENFLAGS := -DPRG_VERSION=$(VERSION) -g -std=c99 \
-Wall -Wwrite-strings -Wmissing-prototypes -Werror -Wno-unused-but-set-variable
dsme_LIBS := cal
dsme: LD_GENFLAGS :=
# dsme-server
dsme-server_C_OBJS := dsme-server.o modulebase.o timers.o \
logging.o oom.o mainloop.o \
dsme-cal.o dsmesock.o
dsme-server_LIBS := dsme dl cal
dsme-server: LD_EXTRA_GENFLAGS := -rdynamic $$(pkg-config --libs gthread-2.0)
#logging.o: C_EXTRA_DEFINES := USE_STDERR
dsme-server.o : C_EXTRA_GENFLAGS := $$(pkg-config --cflags glib-2.0)
mainloop.o : C_EXTRA_GENFLAGS := $$(pkg-config --cflags glib-2.0)
modulebase.o : C_EXTRA_GENFLAGS := $$(pkg-config --cflags glib-2.0)
timers.o : C_EXTRA_GENFLAGS := $$(pkg-config --cflags glib-2.0)
dsmesock.o : C_EXTRA_GENFLAGS := $$(pkg-config --cflags glib-2.0)
# TODO: move dsme-exec-helper to modules/
# dsme-exec-helper
dsme-exec-helper_C_OBJS := dsme-exec-helper.o oom.o
dsme-exec-helper.o : C_EXTRA_GENFLAGS := $$(pkg-config --cflags glib-2.0)
#
# This is the topdir for build
#
TOPDIR := $(shell /bin/pwd)
#
# Non-target files/directories to be deleted by distclean
#
DISTCLEAN_DIRS := doc tags
#DISTCLN_SUBDIRS := _distclean_tests
#
# Actual rules
#
include $(TOPDIR)/Rules.make
.PHONY: tags
tags:
find . -name '*.[hc]' |xargs ctags
.PHONY: doc
doc:
doxygen
local_install:
mkdir -p $(DESTDIR)/etc/dsme
install -m 600 -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) lifeguard.uids $(DESTDIR)/etc/dsme
.PHONY: test
test: all
make -C test depend
make -C test
make -C test run