1 | SHELL = /bin/sh
|
---|
2 |
|
---|
3 | .SUFFIXES:
|
---|
4 | .SUFFIXES: .o .c
|
---|
5 | .PHONY: all help README.build README.config simple default debug config menuconfig allyesconfig allnoconfig defconfig clean distclean
|
---|
6 |
|
---|
7 | VER := $(shell ./config.sh --oscam-version)
|
---|
8 | SVN_REV := $(shell ./config.sh --oscam-revision)
|
---|
9 |
|
---|
10 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
---|
11 |
|
---|
12 | LINKER_VER_OPT:=-Wl,--version
|
---|
13 |
|
---|
14 | # Find OSX SDK
|
---|
15 | ifeq ($(uname_S),Darwin)
|
---|
16 | # Setting OSX_VER allows you to choose prefered version if you have
|
---|
17 | # two SDKs installed. For example if you have 10.6 and 10.5 installed
|
---|
18 | # you can choose 10.5 by using 'make USE_PCSC=1 OSX_VER=10.5'
|
---|
19 | # './config.sh --detect-osx-sdk-version' returns the newest SDK if
|
---|
20 | # SDK_VER is not set.
|
---|
21 | OSX_SDK := $(shell ./config.sh --detect-osx-sdk-version $(OSX_VER))
|
---|
22 | LINKER_VER_OPT:=-Wl,-v
|
---|
23 | endif
|
---|
24 |
|
---|
25 | ifeq "$(shell ./config.sh --enabled WITH_SSL)" "Y"
|
---|
26 | override USE_SSL=1
|
---|
27 | override USE_LIBCRYPTO=1
|
---|
28 | endif
|
---|
29 | ifdef USE_SSL
|
---|
30 | override USE_LIBCRYPTO=1
|
---|
31 | endif
|
---|
32 |
|
---|
33 | CONF_DIR = /usr/local/etc
|
---|
34 |
|
---|
35 | LIB_PTHREAD = -lpthread
|
---|
36 | LIB_DL = -ldl
|
---|
37 | ifeq ($(uname_S),FreeBSD)
|
---|
38 | LIB_DL :=
|
---|
39 | endif
|
---|
40 |
|
---|
41 | override STD_LIBS := $(LIB_PTHREAD) $(LIB_DL)
|
---|
42 | override STD_DEFS := -D'CS_SVN_VERSION="$(SVN_REV)"'
|
---|
43 | override STD_DEFS += -D'CS_CONFDIR="$(CONF_DIR)"'
|
---|
44 |
|
---|
45 | # Compiler warnings
|
---|
46 | CC_WARN = -W -Wall -Wshadow -Wredundant-decls -Wstrict-prototypes -Wold-style-definition
|
---|
47 |
|
---|
48 | # Compiler optimizations
|
---|
49 | CC_OPTS = -O2 -ggdb -pipe -ffunction-sections -fdata-sections
|
---|
50 |
|
---|
51 | CC = $(CROSS_DIR)$(CROSS)gcc
|
---|
52 | STRIP = $(CROSS_DIR)$(CROSS)strip
|
---|
53 |
|
---|
54 | LDFLAGS = -Wl,--gc-sections
|
---|
55 |
|
---|
56 | # The linker for powerpc have bug that prevents --gc-sections from working
|
---|
57 | # Check for the linker version and if it matches disable --gc-sections
|
---|
58 | # For more information about the bug see:
|
---|
59 | # http://cygwin.com/ml/binutils/2005-01/msg00103.html
|
---|
60 | # The LD output is saved into variable and then processed, because if
|
---|
61 | # the output is piped directly into another command LD creates 4 files
|
---|
62 | # in your /tmp directory and doesn't delete them.
|
---|
63 | LINKER_VER := $(shell set -e; VER="`$(CC) $(LINKER_VER_OPT) 2>&1`"; echo $$VER | head -1 | cut -d' ' -f5)
|
---|
64 |
|
---|
65 | # dm500 toolchain
|
---|
66 | ifeq "$(LINKER_VER)" "20040727"
|
---|
67 | LDFLAGS :=
|
---|
68 | endif
|
---|
69 | # dm600/7000/7020 toolchain
|
---|
70 | ifeq "$(LINKER_VER)" "20041121"
|
---|
71 | LDFLAGS :=
|
---|
72 | endif
|
---|
73 | # The OS X linker do not support --gc-sections
|
---|
74 | ifeq ($(uname_S),Darwin)
|
---|
75 | LDFLAGS :=
|
---|
76 | endif
|
---|
77 |
|
---|
78 | # The compiler knows for what target it compiles, so use this information
|
---|
79 | TARGET := $(shell $(CC) -dumpmachine 2>/dev/null)
|
---|
80 |
|
---|
81 | # Process USE_ variables
|
---|
82 | DEFAULT_STAPI_LIB = -L./stapi -loscam_stapi
|
---|
83 | DEFAULT_COOLAPI_LIB = -lnxp -lrt
|
---|
84 | DEFAULT_AZBOX_LIB = -Lextapi/openxcas -lOpenXCASAPI
|
---|
85 | DEFAULT_LIBCRYPTO_LIB = -lcrypto
|
---|
86 | DEFAULT_SSL_LIB = -lssl
|
---|
87 | ifeq ($(uname_S),Linux)
|
---|
88 | DEFAULT_LIBUSB_LIB = -lusb-1.0 -lrt
|
---|
89 | else
|
---|
90 | DEFAULT_LIBUSB_LIB = -lusb-1.0
|
---|
91 | endif
|
---|
92 | ifeq ($(uname_S),Darwin)
|
---|
93 | DEFAULT_PCSC_FLAGS = -isysroot $(OSX_SDK) -I/usr/local/include
|
---|
94 | DEFAULT_PCSC_LIB = -syslibroot,$(OSX_SDK) -framework IOKit -framework CoreFoundation -framework PCSC -L/usr/local/lib
|
---|
95 | else
|
---|
96 | DEFAULT_PCSC_FLAGS = -I/usr/include/PCSC
|
---|
97 | DEFAULT_PCSC_LIB = -lpcsclite
|
---|
98 | endif
|
---|
99 |
|
---|
100 | # Function to initialize USE related variables
|
---|
101 | # Usage: $(eval $(call prepare_use_flags,FLAG_NAME,PLUS_TARGET_TEXT))
|
---|
102 | define prepare_use_flags
|
---|
103 | override DEFAULT_$(1)_FLAGS:=$$(strip -DWITH_$(1)=1 $$(DEFAULT_$(1)_FLAGS))
|
---|
104 | ifdef USE_$(1)
|
---|
105 | $(1)_FLAGS:=$$(DEFAULT_$(1)_FLAGS)
|
---|
106 | $(1)_CFLAGS:=$$($(1)_FLAGS)
|
---|
107 | $(1)_LDFLAGS:=$$($(1)_FLAGS)
|
---|
108 | $(1)_LIB:=$$(DEFAULT_$(1)_LIB)
|
---|
109 | ifneq "$(2)" ""
|
---|
110 | override PLUS_TARGET:=$$(PLUS_TARGET)-$(2)
|
---|
111 | endif
|
---|
112 | override USE_CFLAGS+=$$($(1)_CFLAGS)
|
---|
113 | override USE_LDFLAGS+=$$($(1)_LDFLAGS)
|
---|
114 | override USE_LIBS+=$$($(1)_LIB)
|
---|
115 | override USE_FLAGS+=$$(if $$(USE_$(1)),USE_$(1))
|
---|
116 | endif
|
---|
117 | endef
|
---|
118 |
|
---|
119 | # Initialize USE variables
|
---|
120 | $(eval $(call prepare_use_flags,STAPI,stapi))
|
---|
121 | $(eval $(call prepare_use_flags,COOLAPI,coolapi))
|
---|
122 | $(eval $(call prepare_use_flags,AZBOX,azbox))
|
---|
123 | $(eval $(call prepare_use_flags,MCA,mca))
|
---|
124 | $(eval $(call prepare_use_flags,SSL,ssl))
|
---|
125 | $(eval $(call prepare_use_flags,LIBCRYPTO,))
|
---|
126 | $(eval $(call prepare_use_flags,LIBUSB,libusb))
|
---|
127 | $(eval $(call prepare_use_flags,PCSC,pcsc))
|
---|
128 |
|
---|
129 | # Add PLUS_TARGET and EXTRA_TARGET to TARGET
|
---|
130 | ifdef NO_PLUS_TARGET
|
---|
131 | override TARGET := $(TARGET)$(EXTRA_TARGET)
|
---|
132 | else
|
---|
133 | override TARGET := $(TARGET)$(PLUS_TARGET)$(EXTRA_TARGET)
|
---|
134 | endif
|
---|
135 |
|
---|
136 | EXTRA_CFLAGS = $(EXTRA_FLAGS)
|
---|
137 | EXTRA_LDFLAGS = $(EXTRA_FLAGS)
|
---|
138 |
|
---|
139 | # Add USE_xxx, EXTRA_xxx and STD_xxx vars
|
---|
140 | override CC_WARN += $(EXTRA_CC_WARN)
|
---|
141 | override CC_OPTS += $(EXTRA_CC_OPTS)
|
---|
142 | override CFLAGS += $(USE_CFLAGS) $(EXTRA_CFLAGS)
|
---|
143 | override LDFLAGS += $(USE_LDFLAGS) $(EXTRA_LDFLAGS)
|
---|
144 | override LIBS += $(USE_LIBS) $(EXTRA_LIBS) $(STD_LIBS)
|
---|
145 |
|
---|
146 | override STD_DEFS += -D'CS_TARGET="$(TARGET)"'
|
---|
147 |
|
---|
148 | # Setup quiet build
|
---|
149 | Q =
|
---|
150 | SAY = @true
|
---|
151 | ifndef V
|
---|
152 | Q = @
|
---|
153 | NP = --no-print-directory
|
---|
154 | SAY = @echo
|
---|
155 | endif
|
---|
156 |
|
---|
157 | BINDIR := Distribution
|
---|
158 | override BUILD_DIR := build
|
---|
159 | OBJDIR := $(BUILD_DIR)/$(TARGET)
|
---|
160 |
|
---|
161 | # Include config.mak which contains variables for all enabled modules
|
---|
162 | # These variables will be used to select only needed files for compilation
|
---|
163 | -include $(OBJDIR)/config.mak
|
---|
164 |
|
---|
165 | OSCAM_BIN := $(BINDIR)/oscam-$(VER)$(SVN_REV)-$(subst cygwin,cygwin.exe,$(TARGET))
|
---|
166 | LIST_SMARGO_BIN := $(BINDIR)/list_smargo-$(VER)$(SVN_REV)-$(subst cygwin,cygwin.exe,$(TARGET))
|
---|
167 |
|
---|
168 | # Build list_smargo-.... only when WITH_LIBUSB build is requested.
|
---|
169 | ifndef USE_LIBUSB
|
---|
170 | override LIST_SMARGO_BIN =
|
---|
171 | endif
|
---|
172 |
|
---|
173 | SRC-$(CONFIG_LIB_AES) += cscrypt/aes.c
|
---|
174 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_add.c
|
---|
175 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_asm.c
|
---|
176 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_ctx.c
|
---|
177 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_div.c
|
---|
178 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_exp.c
|
---|
179 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_lib.c
|
---|
180 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_mul.c
|
---|
181 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_print.c
|
---|
182 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_shift.c
|
---|
183 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_sqr.c
|
---|
184 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_word.c
|
---|
185 | SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/mem.c
|
---|
186 | SRC-$(CONFIG_LIB_DES) += cscrypt/des.c
|
---|
187 | SRC-$(CONFIG_LIB_IDEA) += cscrypt/i_cbc.c
|
---|
188 | SRC-$(CONFIG_LIB_IDEA) += cscrypt/i_ecb.c
|
---|
189 | SRC-$(CONFIG_LIB_IDEA) += cscrypt/i_skey.c
|
---|
190 | SRC-y += cscrypt/md5.c
|
---|
191 | SRC-$(CONFIG_LIB_RC6) += cscrypt/rc6.c
|
---|
192 | SRC-$(CONFIG_LIB_SHA1) += cscrypt/sha1.c
|
---|
193 |
|
---|
194 | SRC-$(CONFIG_WITH_CARDREADER) += csctapi/atr.c
|
---|
195 | SRC-$(CONFIG_WITH_CARDREADER) += csctapi/icc_async.c
|
---|
196 | SRC-$(CONFIG_WITH_CARDREADER) += csctapi/io_serial.c
|
---|
197 | SRC-$(CONFIG_WITH_CARDREADER) += csctapi/protocol_t0.c
|
---|
198 | SRC-$(CONFIG_WITH_CARDREADER) += csctapi/protocol_t1.c
|
---|
199 | SRC-$(CONFIG_CARDREADER_INTERNAL_AZBOX) += csctapi/ifd_azbox.c
|
---|
200 | SRC-$(CONFIG_CARDREADER_INTERNAL_COOLAPI) += csctapi/ifd_cool.c
|
---|
201 | SRC-$(CONFIG_CARDREADER_DB2COM) += csctapi/ifd_db2com.c
|
---|
202 | SRC-$(CONFIG_CARDREADER_MP35) += csctapi/ifd_mp35.c
|
---|
203 | SRC-$(CONFIG_CARDREADER_PCSC) += csctapi/ifd_pcsc.c
|
---|
204 | SRC-$(CONFIG_CARDREADER_PHOENIX) += csctapi/ifd_phoenix.c
|
---|
205 | SRC-$(CONFIG_CARDREADER_SC8IN1) += csctapi/ifd_sc8in1.c
|
---|
206 | SRC-$(CONFIG_CARDREADER_INTERNAL_SCI) += csctapi/ifd_sci.c
|
---|
207 | SRC-$(CONFIG_CARDREADER_SMARGO) += csctapi/ifd_smargo.c
|
---|
208 | SRC-$(CONFIG_CARDREADER_SMART) += csctapi/ifd_smartreader.c
|
---|
209 | SRC-$(CONFIG_CARDREADER_STAPI) += csctapi/ifd_stapi.c
|
---|
210 |
|
---|
211 | SRC-$(CONFIG_LIB_MINILZO) += minilzo/minilzo.c
|
---|
212 |
|
---|
213 | SRC-$(CONFIG_CS_ANTICASC) += module-anticasc.c
|
---|
214 | SRC-$(CONFIG_CS_CACHEEX) += module-cacheex.c
|
---|
215 | SRC-$(CONFIG_MODULE_CAMD33) += module-camd33.c
|
---|
216 | SRC-$(sort $(CONFIG_MODULE_CAMD35) $(CONFIG_MODULE_CAMD35_TCP)) += module-camd35.c
|
---|
217 | SRC-$(CONFIG_MODULE_CCCAM) += module-cccam.c
|
---|
218 | SRC-$(CONFIG_MODULE_CCCSHARE) += module-cccshare.c
|
---|
219 | SRC-$(CONFIG_MODULE_CONSTCW) += module-constcw.c
|
---|
220 | SRC-$(CONFIG_CS_CACHEEX) += module-csp.c
|
---|
221 | SRC-$(CONFIG_CW_CYCLE_CHECK) += module-cw-cycle-check.c
|
---|
222 | SRC-$(CONFIG_WITH_AZBOX) += module-dvbapi-azbox.c
|
---|
223 | SRC-$(CONFIG_WITH_MCA) += module-dvbapi-mca.c
|
---|
224 | SRC-$(CONFIG_WITH_COOLAPI) += module-dvbapi-coolapi.c
|
---|
225 | SRC-$(CONFIG_WITH_STAPI) += module-dvbapi-stapi.c
|
---|
226 | SRC-$(CONFIG_HAVE_DVBAPI) += module-dvbapi.c
|
---|
227 | SRC-$(CONFIG_MODULE_GBOX) += module-gbox.c
|
---|
228 | SRC-$(CONFIG_IRDETO_GUESSING) += module-ird-guess.c
|
---|
229 | SRC-$(CONFIG_LCDSUPPORT) += module-lcd.c
|
---|
230 | SRC-$(CONFIG_LEDSUPPORT) += module-led.c
|
---|
231 | SRC-$(CONFIG_MODULE_MONITOR) += module-monitor.c
|
---|
232 | SRC-$(CONFIG_MODULE_NEWCAMD) += module-newcamd.c
|
---|
233 | SRC-$(CONFIG_MODULE_PANDORA) += module-pandora.c
|
---|
234 | SRC-$(CONFIG_MODULE_GHTTP) += module-ghttp.c
|
---|
235 | SRC-$(CONFIG_MODULE_RADEGAST) += module-radegast.c
|
---|
236 | SRC-$(CONFIG_MODULE_SERIAL) += module-serial.c
|
---|
237 | SRC-$(CONFIG_WITH_LB) += module-stat.c
|
---|
238 | SRC-$(CONFIG_WEBIF) += module-webif-lib.c
|
---|
239 | SRC-$(CONFIG_WEBIF) += module-webif-tpl.c
|
---|
240 | SRC-$(CONFIG_WEBIF) += module-webif.c
|
---|
241 | SRC-$(CONFIG_WEBIF) += webif/pages.c
|
---|
242 | SRC-$(CONFIG_WITH_CARDREADER) += reader-common.c
|
---|
243 | SRC-$(CONFIG_READER_BULCRYPT) += reader-bulcrypt.c
|
---|
244 | SRC-$(CONFIG_READER_CONAX) += reader-conax.c
|
---|
245 | SRC-$(CONFIG_READER_CRYPTOWORKS) += reader-cryptoworks.c
|
---|
246 | SRC-$(CONFIG_READER_DGCRYPT) += reader-dgcrypt.c
|
---|
247 | SRC-$(CONFIG_READER_DRE) += reader-dre.c
|
---|
248 | SRC-$(CONFIG_READER_GRIFFIN) += reader-griffin.c
|
---|
249 | SRC-$(CONFIG_READER_IRDETO) += reader-irdeto.c
|
---|
250 | SRC-$(CONFIG_READER_NAGRA) += reader-nagra.c
|
---|
251 | SRC-$(CONFIG_READER_SECA) += reader-seca.c
|
---|
252 | SRC-$(CONFIG_READER_TONGFANG) += reader-tongfang.c
|
---|
253 | SRC-$(CONFIG_READER_VIACCESS) += reader-viaccess.c
|
---|
254 | SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard-common.c
|
---|
255 | SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard1.c
|
---|
256 | SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard12.c
|
---|
257 | SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard2.c
|
---|
258 | SRC-y += oscam-aes.c
|
---|
259 | SRC-y += oscam-chk.c
|
---|
260 | SRC-y += oscam-client.c
|
---|
261 | SRC-y += oscam-conf.c
|
---|
262 | SRC-y += oscam-conf-chk.c
|
---|
263 | SRC-y += oscam-conf-mk.c
|
---|
264 | SRC-y += oscam-config-account.c
|
---|
265 | SRC-y += oscam-config-global.c
|
---|
266 | SRC-y += oscam-config-reader.c
|
---|
267 | SRC-y += oscam-config.c
|
---|
268 | SRC-y += oscam-ecm.c
|
---|
269 | SRC-y += oscam-emm.c
|
---|
270 | SRC-y += oscam-failban.c
|
---|
271 | SRC-y += oscam-files.c
|
---|
272 | SRC-y += oscam-garbage.c
|
---|
273 | SRC-y += oscam-lock.c
|
---|
274 | SRC-y += oscam-log.c
|
---|
275 | SRC-y += oscam-log-reader.c
|
---|
276 | SRC-y += oscam-net.c
|
---|
277 | SRC-y += oscam-llist.c
|
---|
278 | SRC-y += oscam-reader.c
|
---|
279 | SRC-y += oscam-simples.c
|
---|
280 | SRC-y += oscam-string.c
|
---|
281 | SRC-y += oscam-time.c
|
---|
282 | SRC-y += oscam-work.c
|
---|
283 | SRC-y += oscam.c
|
---|
284 | # config.c is automatically generated by config.sh in OBJDIR
|
---|
285 | SRC-y += config.c
|
---|
286 |
|
---|
287 | SRC := $(SRC-y)
|
---|
288 | OBJ := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(SRC)))
|
---|
289 | SRC := $(subst config.c,$(OBJDIR)/config.c,$(SRC))
|
---|
290 |
|
---|
291 | # The default build target rebuilds the config.mak if needed and then
|
---|
292 | # starts the compilation.
|
---|
293 | all:
|
---|
294 | @./config.sh --use-flags "$(USE_FLAGS)" --objdir "$(OBJDIR)" --make-config.mak
|
---|
295 | @-mkdir -p $(OBJDIR)/cscrypt $(OBJDIR)/csctapi $(OBJDIR)/minilzo $(OBJDIR)/webif
|
---|
296 | @-printf "\
|
---|
297 | +-------------------------------------------------------------------------------\n\
|
---|
298 | | OSCam ver: $(VER) rev: $(SVN_REV) target: $(TARGET)\n\
|
---|
299 | | Tools:\n\
|
---|
300 | | CROSS = $(CROSS_DIR)$(CROSS)\n\
|
---|
301 | | CC = $(CC)\n\
|
---|
302 | | Settings:\n\
|
---|
303 | | CONF_DIR = $(CONF_DIR)\n\
|
---|
304 | | CC_OPTS = $(strip $(CC_OPTS))\n\
|
---|
305 | | CC_WARN = $(strip $(CC_WARN))\n\
|
---|
306 | | CFLAGS = $(strip $(CFLAGS))\n\
|
---|
307 | | LDFLAGS = $(strip $(LDFLAGS))\n\
|
---|
308 | | LIBS = $(strip $(LIBS))\n\
|
---|
309 | | UseFlags = $(addsuffix =1,$(USE_FLAGS))\n\
|
---|
310 | | Config:\n\
|
---|
311 | | Addons : $(shell ./config.sh --show-enabled addons)\n\
|
---|
312 | | Protocols: $(shell ./config.sh --show-enabled protocols | sed -e 's|MODULE_||g')\n\
|
---|
313 | | Readers : $(shell ./config.sh --show-enabled readers | sed -e 's|READER_||g')\n\
|
---|
314 | | CardRdrs : $(shell ./config.sh --show-enabled card_readers | sed -e 's|CARDREADER_||g')\n\
|
---|
315 | | Compiler : $(shell $(CC) --version 2>/dev/null | head -n 1)\n\
|
---|
316 | | Binary : $(OSCAM_BIN)\n\
|
---|
317 | +-------------------------------------------------------------------------------\n"
|
---|
318 | @$(MAKE) --no-print-directory --quiet -C webif
|
---|
319 | @$(MAKE) --no-print-directory $(OSCAM_BIN) $(LIST_SMARGO_BIN)
|
---|
320 |
|
---|
321 | $(OSCAM_BIN).debug: $(OBJ)
|
---|
322 | $(SAY) "LINK $@"
|
---|
323 | $(Q)$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
|
---|
324 |
|
---|
325 | $(OSCAM_BIN): $(OSCAM_BIN).debug
|
---|
326 | $(SAY) "STRIP $@"
|
---|
327 | $(Q)cp $(OSCAM_BIN).debug $(OSCAM_BIN)
|
---|
328 | $(Q)$(STRIP) $(OSCAM_BIN)
|
---|
329 |
|
---|
330 | $(LIST_SMARGO_BIN): utils/list_smargo.c
|
---|
331 | $(SAY) "BUILD $@"
|
---|
332 | $(Q)$(CC) $(STD_DEFS) $(CC_OPTS) $(CC_WARN) $(CFLAGS) $(LDFLAGS) utils/list_smargo.c $(LIBS) -o $@
|
---|
333 |
|
---|
334 | $(OBJDIR)/config.o: $(OBJDIR)/config.c
|
---|
335 | $(SAY) "CONF $<"
|
---|
336 | $(Q)$(CC) $(STD_DEFS) $(CC_OPTS) $(CC_WARN) $(CFLAGS) -c $< -o $@
|
---|
337 |
|
---|
338 | $(OBJDIR)/%.o: %.c Makefile
|
---|
339 | @$(CC) -MP -MM -MT $@ -o $(subst .o,.d,$@) $<
|
---|
340 | $(SAY) "CC $<"
|
---|
341 | $(Q)$(CC) $(STD_DEFS) $(CC_OPTS) $(CC_WARN) $(CFLAGS) -c $< -o $@
|
---|
342 |
|
---|
343 | -include $(subst .o,.d,$(OBJ))
|
---|
344 |
|
---|
345 | config:
|
---|
346 | $(SHELL) ./config.sh --gui
|
---|
347 |
|
---|
348 | menuconfig: config
|
---|
349 |
|
---|
350 | allyesconfig:
|
---|
351 | @echo "Enabling all config options."
|
---|
352 | @-$(SHELL) ./config.sh --enable all
|
---|
353 |
|
---|
354 | allnoconfig:
|
---|
355 | @echo "Disabling all config options."
|
---|
356 | @-$(SHELL) ./config.sh --disable all
|
---|
357 |
|
---|
358 | defconfig:
|
---|
359 | @echo "Restoring default config."
|
---|
360 | @-$(SHELL) ./config.sh --restore
|
---|
361 |
|
---|
362 | clean:
|
---|
363 | @-for FILE in $(BUILD_DIR)/*; do \
|
---|
364 | echo "RM $$FILE"; \
|
---|
365 | rm -rf $$FILE; \
|
---|
366 | done
|
---|
367 | @-rm -rf $(BUILD_DIR) lib
|
---|
368 |
|
---|
369 | distclean: clean
|
---|
370 | @-for FILE in $(BINDIR)/list_smargo-* $(BINDIR)/oscam-$(VER)*; do \
|
---|
371 | echo "RM $$FILE"; \
|
---|
372 | rm -rf $$FILE; \
|
---|
373 | done
|
---|
374 | @-make --no-print-directory --quiet -C webif clean
|
---|
375 |
|
---|
376 | README.build:
|
---|
377 | @echo "Extracting 'make help' into $@ file."
|
---|
378 | @-printf "\
|
---|
379 | ** This file is generated from 'make help' output, do not edit it. **\n\
|
---|
380 | \n\
|
---|
381 | " > $@
|
---|
382 | @-make --no-print-directory help >> $@
|
---|
383 | @echo "Done."
|
---|
384 |
|
---|
385 | README.config:
|
---|
386 | @echo "Extracting 'config.sh --help' into $@ file."
|
---|
387 | @-printf "\
|
---|
388 | ** This file is generated from 'config.sh --help' output, do not edit it. **\n\
|
---|
389 | \n\
|
---|
390 | " > $@
|
---|
391 | @-./config.sh --help >> $@
|
---|
392 | @echo "Done."
|
---|
393 |
|
---|
394 | help:
|
---|
395 | @-printf "\
|
---|
396 | OSCam build system documentation\n\
|
---|
397 | ================================\n\
|
---|
398 | \n\
|
---|
399 | Build variables:\n\
|
---|
400 | The build variables are set on the make command line and control the build\n\
|
---|
401 | process. Setting the variables lets you enable additional features, request\n\
|
---|
402 | extra libraries and more. Currently recognized build variables are:\n\
|
---|
403 | \n\
|
---|
404 | CROSS=prefix - Set tools prefix. This variable is used when OScam is being\n\
|
---|
405 | cross compiled. For example if you want to cross compile\n\
|
---|
406 | for SH4 architecture you can run: 'make CROSS=sh4-linux-'\n\
|
---|
407 | If you don't have the directory where cross compilers are\n\
|
---|
408 | in your PATH you can run:\n\
|
---|
409 | 'make CROSS=/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-'\n\
|
---|
410 | \n\
|
---|
411 | CROSS_DIR=dir - Set tools directory. This variable is added in front of\n\
|
---|
412 | CROSS variable. CROSS_DIR is useful if you want to use\n\
|
---|
413 | predefined targets that are setting CROSS, but you don't have\n\
|
---|
414 | the cross compilers in your PATH. For example:\n\
|
---|
415 | 'make sh4 CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/'\n\
|
---|
416 | 'make dm500 CROSS_DIR=/opt/cross/dm500/cdk/bin/'\n\
|
---|
417 | \n\
|
---|
418 | CONF_DIR=/dir - Set OSCam config directory. For example to change config\n\
|
---|
419 | directory to /etc run: 'make CONF_DIR=/etc'\n\
|
---|
420 | The default config directory is: '$(CONF_DIR)'\n\
|
---|
421 | \n\
|
---|
422 | CC_OPTS=text - This variable holds compiler optimization parameters.\n\
|
---|
423 | Default CC_OPTS value is:\n\
|
---|
424 | '$(CC_OPTS)'\n\
|
---|
425 | To add text to this variable set EXTRA_CC_OPTS=text.\n\
|
---|
426 | \n\
|
---|
427 | CC_WARN=text - This variable holds compiler warning parameters.\n\
|
---|
428 | Default CC_WARN value is:\n\
|
---|
429 | '$(CC_WARN)'\n\
|
---|
430 | To add text to this variable set EXTRA_CC_WARN=text.\n\
|
---|
431 | \n\
|
---|
432 | V=1 - Request build process to print verbose messages. By\n\
|
---|
433 | default the only messages that are shown are simple info\n\
|
---|
434 | what is being compiled. To request verbose build run:\n\
|
---|
435 | 'make V=1'\n\
|
---|
436 | \n\
|
---|
437 | Extra build variables:\n\
|
---|
438 | These variables add text to build variables. They are useful if you want\n\
|
---|
439 | to add additional options to already set variables without overwriting them\n\
|
---|
440 | Currently defined EXTRA_xxx variables are:\n\
|
---|
441 | \n\
|
---|
442 | EXTRA_CC_OPTS - Add text to CC_OPTS.\n\
|
---|
443 | Example: 'make EXTRA_CC_OPTS=-Os'\n\
|
---|
444 | \n\
|
---|
445 | EXTRA_CC_WARN - Add text to CC_WARN.\n\
|
---|
446 | Example: 'make EXTRA_CC_WARN=-Wshadow'\n\
|
---|
447 | \n\
|
---|
448 | EXTRA_TARGET - Add text to TARGET.\n\
|
---|
449 | Example: 'make EXTRA_TARGET=-private'\n\
|
---|
450 | \n\
|
---|
451 | EXTRA_CFLAGS - Add text to CFLAGS (affects compilation).\n\
|
---|
452 | Example: 'make EXTRA_CFLAGS=\"-DBLAH=1 -I/opt/local\"'\n\
|
---|
453 | \n\
|
---|
454 | EXTRA_LDFLAGS - Add text to LDFLAGS (affects linking).\n\
|
---|
455 | Example: 'make EXTRA_LDFLAGS=-Llibdir'\n\
|
---|
456 | \n\
|
---|
457 | EXTRA_FLAGS - Add text to both EXTRA_CFLAGS and EXTRA_LDFLAGS.\n\
|
---|
458 | Example: 'make EXTRA_FLAGS=-DBLAH=1'\n\
|
---|
459 | \n\
|
---|
460 | EXTRA_LIBS - Add text to LIBS (affects linking).\n\
|
---|
461 | Example: 'make EXTRA_LIBS=\"-L./stapi -loscam_stapi\"'\n\
|
---|
462 | \n\
|
---|
463 | Use flags:\n\
|
---|
464 | Use flags are used to request additional libraries or features to be used\n\
|
---|
465 | by OSCam. Currently defined USE_xxx flags are:\n\
|
---|
466 | \n\
|
---|
467 | USE_LIBUSB=1 - Request linking with libusb. The variables that control\n\
|
---|
468 | USE_LIBUSB=1 build are:\n\
|
---|
469 | LIBUSB_FLAGS='$(DEFAULT_LIBUSB_FLAGS)'\n\
|
---|
470 | LIBUSB_CFLAGS='$(DEFAULT_LIBUSB_FLAGS)'\n\
|
---|
471 | LIBUSB_LDFLAGS='$(DEFAULT_LIBUSB_FLAGS)'\n\
|
---|
472 | LIBUSB_LIB='$(DEFAULT_LIBUSB_LIB)'\n\
|
---|
473 | Using USE_LIBUSB=1 adds to '-libusb' to PLUS_TARGET.\n\
|
---|
474 | To build with static libusb, set the variable LIBUSB_LIB\n\
|
---|
475 | to contain full path of libusb library. For example:\n\
|
---|
476 | make USR_LIBUSB=1 LIBUSB_LIB=/usr/lib/libusb-1.0.a\n\
|
---|
477 | \n\
|
---|
478 | USE_PCSC=1 - Request linking with PCSC. The variables that control\n\
|
---|
479 | USE_PCSC=1 build are:\n\
|
---|
480 | PCSC_FLAGS='$(DEFAULT_PCSC_FLAGS)'\n\
|
---|
481 | PCSC_CFLAGS='$(DEFAULT_PCSC_FLAGS)'\n\
|
---|
482 | PCSC_LDFLAGS='$(DEFAULT_PCSC_FLAGS)'\n\
|
---|
483 | PCSC_LIB='$(DEFAULT_PCSC_LIB)'\n\
|
---|
484 | Using USE_PCSC=1 adds to '-pcsc' to PLUS_TARGET.\n\
|
---|
485 | To build with static PCSC, set the variable PCSC_LIB\n\
|
---|
486 | to contain full path of PCSC library. For example:\n\
|
---|
487 | make USE_PCSC=1 PCSC_LIB=/usr/local/lib/libpcsclite.a\n\
|
---|
488 | \n\
|
---|
489 | USE_STAPI=1 - Request linking with STAPI. The variables that control\n\
|
---|
490 | USE_STAPI=1 build are:\n\
|
---|
491 | STAPI_FLAGS='$(DEFAULT_STAPI_FLAGS)'\n\
|
---|
492 | STAPI_CFLAGS='$(DEFAULT_STAPI_FLAGS)'\n\
|
---|
493 | STAPI_LDFLAGS='$(DEFAULT_STAPI_FLAGS)'\n\
|
---|
494 | STAPI_LIB='$(DEFAULT_STAPI_LIB)'\n\
|
---|
495 | Using USE_STAPI=1 adds to '-stapi' to PLUS_TARGET.\n\
|
---|
496 | In order for USE_STAPI to work you have to create stapi\n\
|
---|
497 | directory and put liboscam_stapi.a file in it.\n\
|
---|
498 | \n\
|
---|
499 | USE_COOLAPI=1 - Request support for Coolstream API (libnxp) aka NeutrinoHD\n\
|
---|
500 | box. The variables that control the build are:\n\
|
---|
501 | COOLAPI_FLAGS='$(DEFAULT_COOLAPI_FLAGS)'\n\
|
---|
502 | COOLAPI_CFLAGS='$(DEFAULT_COOLAPI_FLAGS)'\n\
|
---|
503 | COOLAPI_LDFLAGS='$(DEFAULT_COOLAPI_FLAGS)'\n\
|
---|
504 | COOLAPI_LIB='$(DEFAULT_COOLAPI_LIB)'\n\
|
---|
505 | Using USE_COOLAPI=1 adds to '-coolapi' to PLUS_TARGET.\n\
|
---|
506 | In order for USE_COOLAPI to work you have to have libnxp.so\n\
|
---|
507 | library in your cross compilation toolchain.\n\
|
---|
508 | \n\
|
---|
509 | USE_AZBOX=1 - Request support for AZBOX (openxcas)\n\
|
---|
510 | box. The variables that control the build are:\n\
|
---|
511 | AZBOX_FLAGS='$(DEFAULT_AZBOX_FLAGS)'\n\
|
---|
512 | AZBOX_CFLAGS='$(DEFAULT_AZBOX_FLAGS)'\n\
|
---|
513 | AZBOX_LDFLAGS='$(DEFAULT_AZBOX_FLAGS)'\n\
|
---|
514 | AZBOX_LIB='$(DEFAULT_AZBOX_LIB)'\n\
|
---|
515 | Using USE_AZBOX=1 adds to '-azbox' to PLUS_TARGET.\n\
|
---|
516 | extapi/openxcas/libOpenXCASAPI.a library that is shipped\n\
|
---|
517 | with OSCam is compiled for MIPSEL.\n\
|
---|
518 | \n\
|
---|
519 | USE_MCA=1 - Request support for Matrix Cam Air (MCA).\n\
|
---|
520 | The variables that control the build are:\n\
|
---|
521 | MCA_FLAGS='$(DEFAULT_MCA_FLAGS)'\n\
|
---|
522 | MCA_CFLAGS='$(DEFAULT_MCA_FLAGS)'\n\
|
---|
523 | MCA_LDFLAGS='$(DEFAULT_MCA_FLAGS)'\n\
|
---|
524 | Using USE_MCA=1 adds to '-mca' to PLUS_TARGET.\n\
|
---|
525 | \n\
|
---|
526 | USE_LIBCRYPTO=1 - Request linking with libcrypto instead of using OSCam\n\
|
---|
527 | internal crypto functions. USE_LIBCRYPTO is automatically\n\
|
---|
528 | enabled if the build is configured with SSL support. The\n\
|
---|
529 | variables that control USE_LIBCRYPTO=1 build are:\n\
|
---|
530 | LIBCRYPTO_FLAGS='$(DEFAULT_LIBCRYPTO_FLAGS)'\n\
|
---|
531 | LIBCRYPTO_CFLAGS='$(DEFAULT_LIBCRYPTO_FLAGS)'\n\
|
---|
532 | LIBCRYPTO_LDFLAGS='$(DEFAULT_LIBCRYPTO_FLAGS)'\n\
|
---|
533 | LIBCRYPTO_LIB='$(DEFAULT_LIBCRYPTO_LIB)'\n\
|
---|
534 | \n\
|
---|
535 | USE_SSL=1 - Request linking with libssl. USE_SSL is automatically\n\
|
---|
536 | enabled if the build is configured with SSL support. The\n\
|
---|
537 | variables that control USE_SSL=1 build are:\n\
|
---|
538 | SSL_FLAGS='$(DEFAULT_SSL_FLAGS)'\n\
|
---|
539 | SSL_CFLAGS='$(DEFAULT_SSL_FLAGS)'\n\
|
---|
540 | SSL_LDFLAGS='$(DEFAULT_SSL_FLAGS)'\n\
|
---|
541 | SSL_LIB='$(DEFAULT_SSL_LIB)'\n\
|
---|
542 | Using USE_SSL=1 adds to '-ssl' to PLUS_TARGET.\n\
|
---|
543 | \n\
|
---|
544 | Automatically intialized variables:\n\
|
---|
545 | \n\
|
---|
546 | TARGET=text - This variable is auto detected by using the compiler's\n\
|
---|
547 | -dumpmachine output. To see the target on your machine run:\n\
|
---|
548 | 'gcc -dumpmachine'\n\
|
---|
549 | \n\
|
---|
550 | PLUS_TARGET - This variable is added to TARGET and it is set depending\n\
|
---|
551 | on the chosen USE_xxx flags. To disable adding\n\
|
---|
552 | PLUS_TARGET to TARGET, set NO_PLUS_TARGET=1\n\
|
---|
553 | \n\
|
---|
554 | BINDIR - The directory where final oscam binary would be put. The\n\
|
---|
555 | default is: $(BINDIR)\n\
|
---|
556 | \n\
|
---|
557 | OSCAM_BIN=text - This variable controls how the oscam binary will be named.\n\
|
---|
558 | Default OSCAM_BIN value is:\n\
|
---|
559 | 'BINDIR/oscam-VERSVN_REV-TARGET'\n\
|
---|
560 | Once the variables (BINDIR, VER, SVN_REV and TARGET) are\n\
|
---|
561 | replaced, the resulting filename can look like this:\n\
|
---|
562 | 'Distribution/oscam-1.20-unstable_svn7404-i486-slackware-linux-static'\n\
|
---|
563 | For example you can run: 'make OSCAM_BIN=my-oscam'\n\
|
---|
564 | \n\
|
---|
565 | Binaries compiled and run during the OSCam build:\n\
|
---|
566 | \n\
|
---|
567 | OSCam builds webif/pages_gen binary that is run by the build system to\n\
|
---|
568 | generate file that holds web pages. To build this binary two variables\n\
|
---|
569 | are used:\n\
|
---|
570 | \n\
|
---|
571 | HOSTCC=gcc - The compiler used for building binaries that are run on\n\
|
---|
572 | the build machine (the host). Default: gcc\n\
|
---|
573 | To use clang for example run: make CC=clang HOSTCC=clang\n\
|
---|
574 | \n\
|
---|
575 | HOSTCFLAGS=xxx - The CFLAGS passed to HOSTCC. See webif/Makefile for the\n\
|
---|
576 | default host cflags.\n\
|
---|
577 | \n\
|
---|
578 | Config targets:\n\
|
---|
579 | make config - Start configuration utility.\n\
|
---|
580 | make allyesconfig - Enable all configuration options.\n\
|
---|
581 | make allnoconfig - Disable all configuration options.\n\
|
---|
582 | make defconfig - Restore default configuration options.\n\
|
---|
583 | \n\
|
---|
584 | Cleaning targets:\n\
|
---|
585 | make clean - Remove '$(BUILD_DIR)' directory which contains compiled\n\
|
---|
586 | object files.\n\
|
---|
587 | make distclean - Executes clean target and also removes binary files\n\
|
---|
588 | located in '$(BINDIR)' directory.\n\
|
---|
589 | \n\
|
---|
590 | Build system files:\n\
|
---|
591 | config.sh - OSCam configuration. Run 'config.sh --help' to see\n\
|
---|
592 | available parameters or 'make config' to start GUI\n\
|
---|
593 | configuratior.\n\
|
---|
594 | Makefile - Main build system file.\n\
|
---|
595 | Makefile.extra - Contains predefined targets. You can use this file\n\
|
---|
596 | as example on how to use the build system.\n\
|
---|
597 | Makefile.local - This file is included in Makefile and allows creation\n\
|
---|
598 | of local build system targets. See Makefile.extra for\n\
|
---|
599 | examples.\n\
|
---|
600 | \n\
|
---|
601 | Here are some of the interesting predefined targets in Makefile.extra.\n\
|
---|
602 | To use them run 'make target ...' where ... can be any extra flag. For\n\
|
---|
603 | example if you want to compile OSCam for Dreambox (DM500) but do not\n\
|
---|
604 | have the compilers in the path, you can run:\n\
|
---|
605 | make dm500 CROSS_DIR=/opt/cross/dm500/cdk/bin/\n\
|
---|
606 | \n\
|
---|
607 | Predefined targets in Makefile.extra:\n\
|
---|
608 | \n\
|
---|
609 | make libusb - Builds OSCam with libusb support\n\
|
---|
610 | make pcsc - Builds OSCam with PCSC support\n\
|
---|
611 | make pcsc-libusb - Builds OSCam with PCSC and libusb support\n\
|
---|
612 | make dm500 - Builds OSCam for Dreambox (DM500)\n\
|
---|
613 | make sh4 - Builds OSCam for SH4 boxes\n\
|
---|
614 | make azbox - Builds OSCam for AZBox STBs\n\
|
---|
615 | make mca - Builds OSCam for Matrix Cam Air (MCA)\n\
|
---|
616 | make coolstream - Builds OSCam for Coolstream\n\
|
---|
617 | make dockstar - Builds OSCam for Dockstar\n\
|
---|
618 | make qboxhd - Builds OSCam for QBoxHD STBs\n\
|
---|
619 | make opensolaris - Builds OSCam for OpenSolaris\n\
|
---|
620 | make uclinux - Builds OSCam for m68k uClinux\n\
|
---|
621 | \n\
|
---|
622 | Predefined targets for static builds:\n\
|
---|
623 | make static - Builds OSCam statically\n\
|
---|
624 | make static-libusb - Builds OSCam with libusb linked statically\n\
|
---|
625 | make static-libcrypto - Builds OSCam with libcrypto linked statically\n\
|
---|
626 | make static-ssl - Builds OSCam with SSL support linked statically\n\
|
---|
627 | \n\
|
---|
628 | Examples:\n\
|
---|
629 | Build OSCam for SH4 (the compilers are in the path):\n\
|
---|
630 | make CROSS=sh4-linux-\n\n\
|
---|
631 | Build OSCam for SH4 (the compilers are in not in the path):\n\
|
---|
632 | make sh4 CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/\n\
|
---|
633 | make CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/ CROSS=sh4-linux-\n\
|
---|
634 | make CROSS=/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-\n\n\
|
---|
635 | Build OSCam for SH4 with STAPI:\n\
|
---|
636 | make CROSS=sh4-linux- USE_STAPI=1\n\n\
|
---|
637 | Build OSCam for SH4 with STAPI and changed configuration directory:\n\
|
---|
638 | make CROSS=sh4-linux- USE_STAPI=1 CONF_DIR=/var/tuxbox/config\n\n\
|
---|
639 | Build OSCam for ARM with COOLAPI (coolstream aka NeutrinoHD):\n\
|
---|
640 | make CROSS=arm-cx2450x-linux-gnueabi- USE_COOLAPI=1\n\n\
|
---|
641 | Build OSCam for MIPSEL with AZBOX support:\n\
|
---|
642 | make CROSS=mipsel-linux-uclibc- USE_AZBOX=1\n\n\
|
---|
643 | Build OSCam for ARM with MCA support:\n\
|
---|
644 | make CROSS=arm-none-linux-gnueabi- USE_MCA=1\n\n\
|
---|
645 | Build OSCam with libusb and PCSC:\n\
|
---|
646 | make USE_LIBUSB=1 USE_PCSC=1\n\n\
|
---|
647 | Build OSCam with static libusb:\n\
|
---|
648 | make USE_LIBUSB=1 LIBUSB_LIB=\"/usr/lib/libusb-1.0.a\"\n\n\
|
---|
649 | Build OSCam with static libcrypto:\n\
|
---|
650 | make USE_LIBCRYPTO=1 LIBCRYPTO_LIB=\"/usr/lib/libcrypto.a\"\n\n\
|
---|
651 | Build OSCam with static libssl and libcrypto:\n\
|
---|
652 | make USE_SSL=1 SSL_LIB=\"/usr/lib/libssl.a\" LIBCRYPTO_LIB=\"/usr/lib/libcrypto.a\"\n\n\
|
---|
653 | Build with verbose messages and size optimizations:\n\
|
---|
654 | make V=1 CC_OPTS=-Os\n\n\
|
---|
655 | Build and set oscam file name:\n\
|
---|
656 | make OSCAM_BIN=oscam\n\n\
|
---|
657 | Build and set oscam file name depending on revision:\n\
|
---|
658 | make OSCAM_BIN=oscam-\`./config.sh -r\`\n\n\
|
---|
659 | "
|
---|
660 |
|
---|
661 | simple: all
|
---|
662 | default: all
|
---|
663 | debug: all
|
---|
664 |
|
---|
665 | -include Makefile.extra
|
---|
666 | -include Makefile.local
|
---|