-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
149 lines (125 loc) · 3.2 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# phiola Makefile
ROOT_DIR := ..
PHIOLA := $(ROOT_DIR)/phiola
FFSYS := $(ROOT_DIR)/ffsys
FFBASE := $(ROOT_DIR)/ffbase
APP_DIR := phiola-2
include $(FFBASE)/conf.mk
SYS := $(OS)
# COMPILER
CFLAGS += -DFFBASE_MEM_ASSERT \
-MMD -MP \
-I$(FFBASE) \
-Wall -Wextra -Wno-unused-parameter -Wno-multichar \
-fPIC -fvisibility=hidden \
-g
ifeq "$(DEBUG)" "1"
CFLAGS += -DFF_DEBUG -O0 -Werror -Wno-deprecated-declarations
else
CFLAGS += -O3 -fno-strict-aliasing
endif
ifeq "$(ASAN)" "1"
CFLAGS += -fsanitize=address
LINKFLAGS += -fsanitize=address
endif
CFLAGS += $(CFLAGS_USER)
CFLAGS_BASE := $(CFLAGS)
CFLAGS += -I$(PHIOLA)/src -I$(FFSYS)
CXXFLAGS := -std=c++11 $(CFLAGS) -fno-exceptions -fno-rtti
CFLAGS := -std=c99 $(CFLAGS)
LINKFLAGS += $(LINKFLAGS_USER)
ifeq "$(OS)" "windows"
LINKFLAGS += -lws2_32
endif
LINK_DL :=
ifeq "$(OS)" "linux"
LINK_DL := -ldl
endif
# MODULES
default: build
ifneq "$(DEBUG)" "1"
$(SUBMAKE) strip-debug
endif
$(SUBMAKE) app
-include $(wildcard *.d)
%.o: $(PHIOLA)/src/%.c
$(C) $(CFLAGS) $< -o $@
%.o: $(FFBASE)/ffbase/%.c
$(C) $(CFLAGS) -DFFBASE_OPT_SIZE $< -o $@
EXES :=
MODS :=
include $(PHIOLA)/src/core/Makefile
include $(PHIOLA)/src/exe/Makefile
include $(PHIOLA)/src/adev/Makefile
include $(PHIOLA)/src/afilter/Makefile
include $(PHIOLA)/src/format/Makefile
ifneq "$(PHI_CODECS)" "0"
include $(PHIOLA)/src/acodec/Makefile
endif
# MISC
ifeq "$(OS)" "linux"
MODS += dbus.$(SO)
sys-sleep-dbus.o: $(PHIOLA)/src/sys-sleep-dbus.c
$(C) $(CFLAGS) `pkg-config --cflags dbus-1` $< -o $@
dbus.$(SO): sys-sleep-dbus.o
$(LINK) -shared $+ $(LINKFLAGS) -ldbus-1 -o $@
endif
MODS += remote.$(SO)
remote.$(SO): remote-ctl.o
$(LINK) -shared $+ $(LINKFLAGS) -o $@
include $(PHIOLA)/src/tui/Makefile
include $(PHIOLA)/src/gui/Makefile
include $(PHIOLA)/src/net/Makefile
include $(PHIOLA)/src/dfilter/Makefile
ifeq "$(TARGETS)" ""
override TARGETS := libphiola.$(SO) $(EXES) $(MODS)
endif
build: $(TARGETS)
strip-debug: $(addsuffix .debug,$(TARGETS))
%.debug: %
$(OBJCOPY) --only-keep-debug $< $@
$(STRIP) $<
$(OBJCOPY) --add-gnu-debuglink=$@ $<
touch $@
app:
$(MKDIR) $(APP_DIR) $(APP_DIR)/mod
$(CP) phiola$(DOTEXE) libphiola.$(SO) \
$(APP_DIR)/
chmod 644 $(APP_DIR)/libphiola.$(SO)
$(CP) $(PHIOLA)/LICENSE \
$(PHIOLA)/README.md \
$(APP_DIR)/
$(CP) $(MODS) $(APP_DIR)/mod/
ifneq "$(LIBS3)" ""
$(CP) $(LIBS3) $(APP_DIR)/mod/
endif
$(CP) $(PHIOLA)/src/tui/help.txt $(APP_DIR)/mod/tui-help.txt
chmod 644 $(APP_DIR)/mod/*.$(SO)
$(CP) $(PHIOLA)/src/net/client.pem $(APP_DIR)/mod/http-client.pem
$(SUBMAKE) app-gui
ifeq "$(OS)" "windows"
mv $(APP_DIR)/README.md $(APP_DIR)/README.txt
unix2dos $(APP_DIR)/README.txt
endif
PKG_VER := test
PKG_ARCH := $(CPU)
PKG_PACKER := tar -c --owner=0 --group=0 --numeric-owner -v --zstd -f
PKG_EXT := tar.zst
ifeq "$(OS)" "windows"
PKG_PACKER := zip -r -v
PKG_EXT := zip
endif
PKG_NAME := phiola-$(PKG_VER)-$(OS)-$(PKG_ARCH).$(PKG_EXT)
package: $(PKG_NAME)
$(PKG_NAME): $(APP_DIR)
$(PKG_PACKER) $@ $<
PKG_DEBUG_NAME := phiola-$(PKG_VER)-$(OS)-$(PKG_ARCH)-debug.$(PKG_EXT)
$(PKG_DEBUG_NAME):
$(PKG_PACKER) $@ *.debug
package-debug: $(PKG_DEBUG_NAME)
release: default
$(SUBMAKE) package
$(SUBMAKE) package-debug
ifeq "$(OS)" "windows"
$(MAKE) -f ../installer/Makefile
endif