-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.win32
362 lines (311 loc) · 13.9 KB
/
Makefile.win32
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
#
# Windows Makefile for nxtvepg - A XMLTV browser and Teletext EPG grabber
#
# Copyright (C) 1999-2011, 2020-2023 T. Zoerner
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License Version 2 as
# published by the Free Software Foundation. You find a copy of this
# license in the file COPYRIGHT in the root directory of this release.
#
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
# BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# Description:
#
# Controls compilation of C and Tcl/Tk source to an executable on
# Windows systems using gcc. This make file requires Cygwin and the
# w32api and mingw header files. In addition to nxtvepg, this
# Makefile also generates the TV application simulator and tools.
#
ifeq ($(OS),Windows_NT)
# compiling on WinNT in Cygwin environment
INCS += -I. -I/usr/include/mingw
ROOT = /cygdrive/d
CC = gcc
CPP = g++
LD = g++
AS = as
NM = nm
WINDRES = windres
DLLTOOL = dlltool
else
# cross-compiling for win32 on UNIX host (requires "gcc-win" package)
INCS += -DNONAMELESSUNION
INCS += -I.
INCS += -I/usr/i586-mingw32msvc/include
GCC_ROOT = /usr/i686-w64-mingw32
AR = $(GCC_ROOT)/bin/ar
AS = $(GCC_ROOT)/bin/as
NM = $(GCC_ROOT)/bin/nm
WINDRES = i686-w64-mingw32-windres
DLLTOOL = $(GCC_ROOT)/bin/dlltool
STRIP = i686-w64-mingw32-strip
#ROOT = $(HOME)/Save/dos
ROOT = /home/tom/Save/dos
CC = i686-w64-mingw32-gcc
CPP = i686-w64-mingw32-g++
LD = i686-w64-mingw32-g++
endif
# if you have perl and/or flex set their path here, else just leave them alone
PERL = /usr/bin/perl
FLEX = /usr/bin/flex
# path to the non-Cygwin Tcl/Tk package
TCLDIR = $(ROOT)/gnu/tcl85
INCS += -I$(TCLDIR)/include
TCL_V = 8.5.6
TCL_L = 85
GUILIBS += -L$(BUILD_DIR) -ltk$(TCL_L) -ltcl$(TCL_L)
ACQLIBS += -lws2_32
# use TCL library for UTF-8 string matching (i.e. required even without GUI)
TCL_LIB = -L$(BUILD_DIR) -ltcl$(TCL_L)
# define this if you don't want to load external Tcl/Tk init scripts
DEFS += -DUSE_PRECOMPILED_TCL_LIBS
# define this if you have patched nxtvepg.ico into the tk DLL
DEFS += -DICON_PATCHED_INTO_DLL
# enable use of daemon and client/server connection (supported only with USE_TTX_GRABBER)
DEFS += -DUSE_DAEMON
# enable if you have both 32-bit and 64-bit systems
#DEFS += -DUSE_32BIT_COMPAT
# XMLTV parser needs to emit UTF-8 to match internal encoding
DEFS += -DXMLTV_OUTPUT_UTF8
# enable support for teletext EPG grabber
DEFS += -DUSE_TTX_GRABBER
DEFS += -DWIN32
WARN = -Wall -Wpointer-arith -Wnested-externs -Wmissing-prototypes
WARN += -Wextra -Wno-sign-compare -Wno-unused-parameter
WARN += -Wcast-align -Wwrite-strings
#WARN += -Werror
#WARN += -Wstrict-prototypes
CFLAGS = -pipe $(WARN) $(INCS) $(DEFS) -g -O2
CPPFLAGS = -pipe $(INCS) $(DEFS) -g -O2
LDFLAGS = -mwindows -Wl,--subsystem,windows -static-libgcc -static-libstdc++
LDFLAGS_CONSOLE = -mconsole -Wl,--subsystem,console
BUILD_DIR = build-win32
INCS += -I$(BUILD_DIR)
# formerly required for O2
#$(BUILD_DIR)/epgui/rcfile.o : CFLAGS += -fno-strict-aliasing
# ----- don't change anything below ------------------------------------------
SUBDIRS = epgvbi epgdb epgctl epgui epgtcl tvsim xmltv epgttx
EPGSRC = epgvbi/btdrv4win epgvbi/vbidecode epgvbi/zvbidecoder \
epgvbi/ttxdecode epgvbi/hamming epgvbi/cni_tables epgvbi/tvchan \
epgvbi/syserrmsg epgvbi/winshmsrv epgdb/epgdbmerge \
epgdb/epgdbmgmt epgdb/epgdbif epgdb/epgdbfil epgdb/epgblock \
epgdb/epgnetio epgdb/epgtscqueue epgdb/ttxgrab \
epgctl/debug epgctl/epgacqctl epgctl/epgacqttx \
epgctl/epgscan epgctl/epgctxctl epgctl/epgctxmerge \
epgctl/epgacqclnt epgctl/epgacqsrv
XMLSRC = xmltv/xml_prolog.tab xmltv/xml_scan.yy xmltv/xml_cdata \
xmltv/xml_hash xmltv/xmltv_tags xmltv/xmltv_db xmltv/xmltv_cni \
xmltv/xmltv_timestamp xmltv/xmltv_main
TTXSRC = epgttx/ttx_scrape epgttx/ttx_date epgttx/ttx_ov_fmt \
epgttx/ttx_feat epgttx/ttx_pg_ref epgttx/ttx_db epgttx/ttx_util \
epgttx/ttx_xmltv epgttx/ttx_cif
GUISRC = epgui/uictrl epgui/pibox epgui/pilistbox epgui/pinetbox \
epgui/pidescr epgui/pioutput epgui/pifilter epgui/piremind \
epgui/statswin epgui/timescale epgui/menucmd \
epgui/epgmain epgui/loadtcl epgui/wintv epgui/wintvcfg \
epgui/wintvui epgui/epgsetup epgui/cmdline epgui/rcfile \
epgui/dumptext epgui/dumphtml epgui/dumpxml epgui/uidump \
epgui/epgquery epgui/shellcmd epgui/wmhooks \
epgui/daemon
CLDSRC = epgui/daemon_main epgui/daemon epgui/epgsetup epgui/cmdline \
epgui/rcfile epgui/wintvcfg epgui/dumptext epgui/dumpxml \
epgui/pidescr epgui/epgquery
TCLSRC = epgtcl/mainwin epgtcl/dlg_hwcfg epgtcl/dlg_xawtvcf \
epgtcl/dlg_ctxmencf epgtcl/dlg_acqmode epgtcl/dlg_netsel \
epgtcl/dlg_dump epgtcl/dlg_netname epgtcl/dlg_udefcols \
epgtcl/shortcuts epgtcl/dlg_shortcuts epgtcl/draw_stats \
epgtcl/dlg_filter epgtcl/dlg_substr epgtcl/dlg_remind \
epgtcl/dlg_prov epgtcl/rcfile epgtcl/helptexts epgtcl/helptexts_de \
epgtcl/mclistbox epgtcl/combobox epgtcl/rnotebook epgtcl/htree
TCLLSRC = epgtcl/tcl_libs epgtcl/tk_libs epgtcl/ttk_libs
TVSIM_CSRC = tvsim/tvsim_main tvsim/winshmclnt
TVSIM_CSRC2 = epgvbi/btdrv4win epgvbi/tvchan epgvbi/vbidecode epgvbi/zvbidecoder \
epgvbi/ttxdecode epgvbi/hamming epgvbi/cni_tables epgvbi/syserrmsg \
epgctl/debug epgui/wintvcfg epgui/wintvui \
epgui/rcfile
TVSIM_TCLSRC = tvsim/tvsim_gui
VBIREC_CSRC = tvsim/vbirec_main
VBIREC_CSRC2 = epgvbi/winshmsrv epgvbi/cni_tables epgvbi/hamming epgctl/debug
VBIREC_TCLSRC = tvsim/vbirec_gui epgtcl/combobox
VBIPLAY_CSRC = tvsim/vbiplay
VBIPLAY_CSRC2 = tvsim/winshmclnt epgctl/debug
TCL_TK_LIBS = $(BUILD_DIR)/libtcl$(TCL_L).a $(BUILD_DIR)/libtk$(TCL_L).a
TCL_SLIBS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(TCLLSRC)))
NXTV_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(EPGSRC) $(GUISRC) $(TCLSRC) $(XMLSRC))) \
$(TCL_SLIBS) $(BUILD_DIR)/epgui/tkwinico.res.o
DAEMON_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(EPGSRC) $(CLDSRC) $(XMLSRC))) \
$(BUILD_DIR)/epgui/tkwinico.res.o
DSDRV_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(DSDRV_CSRC)))
TVCARD_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(TVCARD_CSRC)))
TVSIM_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(TVSIM_CSRC) $(TVSIM_CSRC2) $(TVSIM_TCLSRC))) $(TCL_SLIBS)
VBIREC_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(VBIREC_CSRC) $(VBIREC_CSRC2) $(VBIREC_TCLSRC))) $(TCL_SLIBS)
VBIPLAY_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(VBIPLAY_CSRC) $(VBIPLAY_CSRC2)))
ifneq (,$(findstring USE_TTX_GRABBER,$(DEFS)))
NXTV_OBJS += $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(TTXSRC)))
DAEMON_OBJS += $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(TTXSRC)))
endif
.PHONY: devel daemon manuals tvsim tvmans all
devel :: build_dir tcl_headers $(BUILD_DIR)/nxtvepg.exe manuals
daemon :: build_dir tcl_headers $(BUILD_DIR)/nxtvepgd.exe manuals
manuals :: nxtvepg.1 nxtvepgd.1 manual.html manual-de.html
tvsim :: build_dir tcl_headers_tvsim $(BUILD_DIR)/tvsim.exe $(BUILD_DIR)/vbirec.exe $(BUILD_DIR)/vbiplay.exe tvmans
tvmans :: tvsim/tvsim.html tvsim/vbirec.html tvsim/vbiplay.html
all :: devel daemon tvsim tvmans verifyxml
$(BUILD_DIR)/nxtvepg.exe: $(NXTV_OBJS) $(TCL_TK_LIBS)
$(LD) $(LDFLAGS) $(NXTV_OBJS) $(GUILIBS) $(ACQLIBS) -o $@
$(BUILD_DIR)/nxtvepgd.exe: $(DAEMON_OBJS)
$(LD) $(LDFLAGS) $(DAEMON_OBJS) $(ACQLIBS) $(TCL_LIB) -o $@
$(BUILD_DIR)/tvsim.exe: $(TVSIM_OBJS) $(TCL_TK_LIBS)
$(LD) $(LDFLAGS) $(TVSIM_OBJS) $(GUILIBS) $(ACQLIBS) -o $@
$(BUILD_DIR)/vbirec.exe: $(VBIREC_OBJS) $(TCL_TK_LIBS)
$(LD) $(LDFLAGS) $(VBIREC_OBJS) $(GUILIBS) $(ACQLIBS) -o $@
$(BUILD_DIR)/vbiplay.exe: $(VBIPLAY_OBJS)
$(LD) $(LDFLAGS) $(VBIPLAY_OBJS) $(GUILIBS) $(ACQLIBS) -o $@
.SUFFIXES: .cc .c .o .tcl
$(BUILD_DIR)/%.o: %.cc
$(CPP) $(CPPFLAGS) -Wp,-MMD,[email protected] -c -o $@ $<
@sed -e "s#^[^ \t].*\.o:#$@:#" < [email protected] > [email protected] && \
rm -f [email protected]
$(BUILD_DIR)/%.o: %.c | tcl_headers tcl_headers_tvsim
$(CC) $(CFLAGS) -Wp,-MMD,[email protected] -c -o $@ $<
@sed -e "s#^[^ \t].*\.o:#$@:#" < [email protected] > [email protected] && \
rm -f [email protected]
$(BUILD_DIR)/%.c: %.tcl $(BUILD_DIR)/tcl2c.exe
$(BUILD_DIR)/tcl2c.exe -c -d -h -p $(BUILD_DIR) $*.tcl
# rule for tcl files which resides in the build tree (e.g. tcl_libs.tcl)
%.c: %.tcl $(BUILD_DIR)/tcl2c.exe
$(BUILD_DIR)/tcl2c.exe -c -d -h $*.tcl
# %.h rule disabled because tcl2c doesn't update timestamp of generated headers
# unless they changed, to avoid excessive re-compilation after internal script
# changes. note: this also requires to add a rule for all .tcl sources in front
# of objects and depend targets to make sure all headers are already generated
# when required, since there's no rule to generate them from Tcl scripts.
#
%.h: %.tcl tcl2c.exe
@if [ ! -e epgtcl/dlg_remind.h ] ; then \
echo "Appearently you typed 'make nxtvepg'" ; \
echo "Don't do that. Instead use simply 'make'" ; \
false ; \
fi
.SUFFIXES: .yy .lex
#%.tab.c: %.yy
# yacc -d -v -b $(basename $<) $<
%.yy.c: %.lex
@if test -x $(FLEX); then \
$(FLEX) -o$@ $< ; \
elif test -f $<; then \
touch $< ; \
else \
echo "ERROR: cannot generate $< without $(FLEX)" ; \
false; \
fi
.PHONY: verifyxml parsexmltv
# standalone XML parser for validation purposes
XMLVERISRC = xmltv/xml_prolog.tab xmltv/xml_scan.yy xmltv/xml_verify \
xmltv/xml_cdata xmltv/xml_hash epgctl/debug
XMLVERIOBJ = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(XMLVERISRC)))
$(BUILD_DIR)/verifyxml : $(XMLVERIOBJ)
$(CC) -o $@ $(XMLVERIOBJ) $(LDFLAGS_CONSOLE)
verifyxml : $(BUILD_DIR)/verifyxml
# standalone XMLTV processor for performance tests
# note: requires uncommenting main() in source module xmltv_db
XMLTESTSRC = $(XMLSRC) $(EPGSRC) epgui/pidescr
XMLTESTOBJ = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(XMLTESTSRC)))
$(BUILD_DIR)/parsexmltv : $(XMLTESTOBJ)
$(CC) -o $@ $(XMLTESTOBJ) $(LDFLAGS) $(ACQLIBS)
parsexmltv : $(BUILD_DIR)/parsexmltv
.PHONY: tcl_headers tcl_headers_tvsim
tcl_headers: $(addprefix $(BUILD_DIR)/, $(addsuffix .c, $(TCLSRC)))
tcl_headers_tvsim: $(addprefix $(BUILD_DIR)/, $(addsuffix .c, $(TVSIM_TCLSRC) $(VBIREC_TCLSRC)))
$(BUILD_DIR)/tcl2c.exe: tcl2c.c
ifeq ($(OS),Windows_NT)
$(CC) -O6 -o $(BUILD_DIR)/tcl2c.exe tcl2c.c
else
gcc -O6 -o $(BUILD_DIR)/tcl2c.exe tcl2c.c
endif
$(BUILD_DIR)/epgtcl/tcl_libs.tcl:
if test -d tcl$(TCL_V); then \
cat tcl$(TCL_V)/*.tcl > $(BUILD_DIR)/epgtcl/tcl_libs.tcl; \
else \
echo "Tcl init scripts not found - abort."; \
false; \
fi
$(BUILD_DIR)/epgtcl/tk_libs.tcl:
if test -d tk$(TCL_V); then \
cat tk$(TCL_V)/*.tcl > $(BUILD_DIR)/epgtcl/tk_libs.tcl; \
else \
echo "Tk init scripts not found - abort."; \
false; \
fi
$(BUILD_DIR)/epgtcl/ttk_libs.tcl:
if test -d tk$(TCL_V); then \
cat tk$(TCL_V)/*.tcl > $(BUILD_DIR)/epgtcl/ttk_libs.tcl; \
else \
echo "Ttk init scripts not found - abort."; \
false; \
fi
epgui/loadtcl.c :: $(addprefix $(BUILD_DIR)/, $(addsuffix .c, $(TCLLSRC)))
$(BUILD_DIR)/epgui/tkwinico.res.o: epgui/tkwinico.rc
$(WINDRES) -o $(BUILD_DIR)/epgui/tkwinico.res.o epgui/tkwinico.rc
#
# Rules to recover linker libraries for Tcl/tk from .def and .dll
#
$(BUILD_DIR)/libtcl$(TCL_L).a: tcl$(TCL_L).dll libtcl$(TCL_L).def
$(DLLTOOL) --as=$(AS) --def libtcl$(TCL_L).def --dllname tcl$(TCL_L).dll --output-lib $@
$(BUILD_DIR)/libtk$(TCL_L).a: tk$(TCL_L).dll libtk$(TCL_L).def
$(DLLTOOL) --as=$(AS) --def libtk$(TCL_L).def --dllname tk$(TCL_L).dll --output-lib $@
#
# Rules to generate .def files from Tcl/Tk linker libraries
# - .def files are included with releases, so these rules should be commented out for distribution
#
#libtcl$(TCL_L).def: $(TCLDIR)/lib/libtcl$(TCL_L).a
# @echo EXPORTS > $@
# $(NM) $(TCLDIR)/lib/libtcl$(TCL_L).a | \
# egrep '^(........|................) [T] _' | sed 's/[^_]*_//' >> $@
#
#libtk$(TCL_L).def: $(TCLDIR)/lib/libtk$(TCL_L).a
# @echo EXPORTS > $@
# $(NM) $(TCLDIR)/lib/libtk$(TCL_L).a | \
# egrep '^(........|................) [T] _' | sed 's/[^_]*_//' >> $@
libtcl$(TCL_L).def libtk$(TCL_L).def:
@echo "Tcl/Tk library .def files are missing - release is incomplete"
@false
.PHONY: zip bak
zip: all
@EPG_VERSION_STR=`egrep '[ \t]*#[ \t]*define[ \t]*EPG_VERSION_STR' epgctl/epgversion.h | head -2 | tail -1 | sed -e 's#.*"\(.*\)".*#\1#'`; \
ARCHIVE=$(BUILD_DIR)/nxtvepg-$${EPG_VERSION_STR}-win.zip; \
echo Packing $$ARCHIVE; \
rm -f $$ARCHIVE; \
$(STRIP) $(BUILD_DIR)/nxtvepg.exe; \
$(STRIP) $(BUILD_DIR)/nxtvepgd.exe; \
zip -9 -j $$ARCHIVE $(BUILD_DIR)/nxtvepg.exe $(BUILD_DIR)/nxtvepgd.exe; \
zip -9 $$ARCHIVE tcl$(TCL_L).dll tk$(TCL_L).dll NextViewPlugin.dll nxtvepg.ico; \
zip -9 $$ARCHIVE -l manual.html manual-de.html Nxtvepg.ad; \
for v in TODO README.md CHANGES COPYRIGHT; do \
mv $$v $${v}.txt; \
zip -9 -l $$ARCHIVE $${v}.txt; \
mv $${v}.txt $$v; \
done; \
zip -0 $$ARCHIVE images/*.png; \
ARCHIVE=$(BUILD_DIR)/nxtvepg-$${EPG_VERSION_STR}-tvsim.zip; \
echo Packing $$ARCHIVE; \
rm -f $$ARCHIVE; \
$(STRIP) $(BUILD_DIR)/tvsim.exe $(BUILD_DIR)/vbirec.exe $(BUILD_DIR)/vbiplay.exe; \
zip -j -9 $$ARCHIVE $(BUILD_DIR)/tvsim.exe $(BUILD_DIR)/vbirec.exe $(BUILD_DIR)/vbiplay.exe; \
zip -j -9 -l $$ARCHIVE tvsim/tvsim.html tvsim/vbirec.html tvsim/vbiplay.html; \
mv COPYRIGHT COPYRIGHT2.txt; \
zip -9 -l $$ARCHIVE COPYRIGHT2.txt; \
mv COPYRIGHT2.txt COPYRIGHT
bak:
cd .. && tar cf /c/winpc.tar pc -X pc/tar-ex-win
.PHONY: build_dir
build_dir:
@mkdir -p $(addprefix $(BUILD_DIR)/,$(SUBDIRS))
# include dependencies (each object has one dependency file)
-include $(BUILD_DIR)/*/*.dep
# end Windows specific part / note more rules follow in UNIX Makefile