forked from stsaz/phiola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
141 lines (117 loc) · 2.95 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
# phiola Makefile
ROOT_DIR := ..
PHIOLA := $(ROOT_DIR)/phiola
FFSYS := $(ROOT_DIR)/ffsys
FFBASE := $(ROOT_DIR)/ffbase
APP_DIR := phiola-2
include $(FFBASE)/conf.mk
SUBMAKE := $(MAKE) -f $(firstword $(MAKEFILE_LIST))
# COMPILER
CFLAGS += -DFFBASE_MEM_ASSERT \
-MMD -MP \
-I$(FFBASE) \
-Wall -Wextra -Wno-unused-parameter -Wno-multichar \
-fPIC \
-g
ifeq "$(DEBUG)" "1"
CFLAGS += -DFF_DEBUG -O0 -Werror -Wno-deprecated-declarations
else
CFLAGS += -O3 -fno-strict-aliasing -fvisibility=hidden
endif
ifeq "$(ASAN)" "1"
CFLAGS += -fsanitize=address
LINKFLAGS += -fsanitize=address
endif
CFLAGS += $(CFLAGS_USER)
CFLAGS_BASE := $(CFLAGS)
CFLAGS += -I$(PHIOLA)/src -I$(FFSYS)
CXXFLAGS := $(CFLAGS) -fno-exceptions -fno-rtti -Wno-c++11-narrowing
ifeq "$(OS)" "windows"
LINKFLAGS += -lws2_32
endif
LINK_DL :=
ifeq "$(OS)" "linux"
LINK_DL := -ldl
endif
# MODULES
ifneq "$(DEBUG)" "1"
default: strip-debug
$(SUBMAKE) app
else
default: build
$(SUBMAKE) app
endif
-include $(wildcard *.d)
DEPS := $(PHIOLA)/src/phiola.h \
$(PHIOLA)/src/track.h
%.o: $(PHIOLA)/src/%.c
$(C) $(CFLAGS) $< -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
build: libphiola.$(SO) \
$(EXES) \
$(MODS)
strip-debug: libphiola.$(SO).debug \
phiola$(DOTEXE).debug \
$(EXES:.exe=.exe.debug) \
$(MODS:.$(SO)=.$(SO).debug)
%.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) $@ $<