# # Windows Makefile for Nextview EPG decoder # # 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. # # # Author: Tom Zoerner # # $Id: Makefile.win32,v 1.51 2004/12/18 14:51:21 tom Exp tom $ # ifeq ($(OS),Windows_NT) # compiling on WinNT in Cygwin environment INCS += -I. -I/usr/include/mingw ROOT = /cygdrive/d CC = gcc AS = as NM = nm WINDRES = windres DLLTOOL = dlltool else # cross-compiling for win32 on UNIX host (requires "gcc-win" package) INCS += -nostdinc -DNONAMELESSUNION INCS += -I. INCS += -I/usr/local/i386-pc-cygwin32/include/mingw INCS += -I/usr/local/i386-pc-cygwin32/include/w32api GCC_ROOT = /usr/local/i386-pc-cygwin32 AR = $(GCC_ROOT)/bin/i386-pc-cygwin32-ar AS = $(GCC_ROOT)/bin/i386-pc-cygwin32-as NM = $(GCC_ROOT)/bin/i386-pc-cygwin32-nm WINDRES = $(GCC_ROOT)/bin/i386-pc-cygwin32-windres DLLTOOL = $(GCC_ROOT)/bin/i386-pc-cygwin32-dlltool ROOT = /d CC = gcc-win endif # if you have perl set the path here, else just leave it alone PERL = /usr/bin/perl # path to the non-Cygwin Tcl/Tk package TCLDIR = $(ROOT)/gnu/tcl834 INCS += -I$(TCLDIR)/include TCL_V = 8.3.4 TCL_L = 83 LDLIBS += -L$(BUILD_DIR) -ltk$(TCL_L) -ltcl$(TCL_L) LDLIBS += -lws2_32 LDLIBS += -L$(BUILD_DIR)/dsdrv -ltvcard -ldsdrv # 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 multi-threading (UNIX only) #DEFS += -DUSE_THREADS # enable use of daemon and client/server connection (UNIX only) DEFS += -DUSE_DAEMON # testing TV app interaction on a host without a TV card #DEFS += -DWITHOUT_TVCARD DEFS += -DWIN32 WARN = -Wall -Wpointer-arith -Wnested-externs -Wmissing-prototypes #WARN += -Wstrict-prototypes -Werror CFLAGS = -pipe $(WARN) $(INCS) $(DEFS) -g -O -mno-cygwin LDFLAGS = -mwindows -mno-cygwin -Wl,--subsystem,windows BUILD_DIR = build-win32 INCS += -I$(BUILD_DIR) # ----- don't change anything below ------------------------------------------ CSRC = epgvbi/btdrv4win epgvbi/vbidecode epgvbi/zvbidecoder \ epgvbi/ttxdecode epgvbi/hamming epgvbi/cni_tables epgvbi/tvchan \ epgvbi/syserrmsg epgvbi/winshmsrv \ epgctl/debug epgctl/epgacqctl epgctl/epgscan epgctl/epgctxctl \ epgctl/epgctxmerge epgctl/epgacqsrv epgctl/epgacqclnt \ epgdb/epgstream epgdb/epgdbmerge epgdb/epgdbsav \ epgdb/epgdbmgmt epgdb/epgdbif epgdb/epgdbfil epgdb/epgblock \ epgdb/epgqueue epgdb/epgtscqueue epgdb/epgnetio \ epgui/uictrl epgui/pibox epgui/pilistbox epgui/pinetbox \ epgui/pidescr epgui/pioutput epgui/pifilter epgui/piremind \ epgui/statswin epgui/timescale epgui/pdc_themes epgui/menucmd \ epgui/epgmain epgui/loadtcl epgui/wintv epgui/wintvcfg \ epgui/dumptext epgui/dumpraw epgui/dumphtml epgui/dumpxml \ epgui/shellcmd epgui/wmhooks 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 \ epgtcl/tcl_libs epgtcl/tk_libs DSDRV_CSRC = dsdrv/dsdrv34 dsdrv/hwdrv dsdrv/hwpci dsdrv/hwmem dsdrv/debuglog TVCARD_CSRC = dsdrv/bt8x8 dsdrv/bt8x8_i2c dsdrv/bt8x8_typ \ dsdrv/saa7134 dsdrv/saa7134_i2c dsdrv/saa7134_typ \ dsdrv/cx2388x dsdrv/cx2388x_typ dsdrv/wintuner TVSIM_CSRC = tvsim/tvsim_main tvsim/winshmclnt TVSIM_CSRC2 = epgvbi/btdrv4win epgvbi/vbidecode epgvbi/zvbidecoder \ epgvbi/ttxdecode epgvbi/hamming epgvbi/cni_tables \ epgctl/debug epgui/pdc_themes epgui/wintvcfg TVSIM_TCLSRC = tvsim/tvsim_gui epgtcl/tcl_libs epgtcl/tk_libs VBIREC_CSRC = tvsim/vbirec_main VBIREC_CSRC2 = epgvbi/winshmsrv epgvbi/cni_tables epgvbi/hamming epgctl/debug VBIREC_TCLSRC = tvsim/vbirec_gui epgtcl/tcl_libs epgtcl/tk_libs 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 NXTV_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(CSRC)) $(addsuffix .o, $(TCLSRC))) \ $(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))) VBIREC_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(VBIREC_CSRC) $(VBIREC_CSRC2) $(VBIREC_TCLSRC))) VBIPLAY_OBJS = $(addprefix $(BUILD_DIR)/, $(addsuffix .o, $(VBIPLAY_CSRC) $(VBIPLAY_CSRC2))) .PHONY: devel manuals tvsim tvmans all devel :: $(BUILD_DIR) tcl_headers $(BUILD_DIR)/nxtvepg.exe manuals manuals :: nxtvepg.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 tvsim $(BUILD_DIR)/nxtvepg.exe: $(BUILD_DIR)/dsdrv/libdsdrv.a $(BUILD_DIR)/dsdrv/libtvcard.a $(NXTV_OBJS) $(TCL_TK_LIBS) $(CC) $(LDFLAGS) $(NXTV_OBJS) $(LDLIBS) -o $@ $(BUILD_DIR)/tvsim.exe: $(BUILD_DIR)/dsdrv/libdsdrv.a $(BUILD_DIR)/dsdrv/libtvcard.a $(TVSIM_OBJS) $(TCL_TK_LIBS) $(CC) $(LDFLAGS) $(TVSIM_OBJS) $(LDLIBS) -o $@ $(BUILD_DIR)/vbirec.exe: $(VBIREC_OBJS) $(TCL_TK_LIBS) $(CC) $(LDFLAGS) $(VBIREC_OBJS) $(LDLIBS) -o $@ $(BUILD_DIR)/vbiplay.exe: $(VBIPLAY_OBJS) $(CC) $(LDFLAGS) $(VBIPLAY_OBJS) $(LDLIBS) -o $@ $(BUILD_DIR)/dsdrv/libdsdrv.a: $(DSDRV_OBJS) $(AR) r $(BUILD_DIR)/dsdrv/libdsdrv.a $(DSDRV_OBJS) $(BUILD_DIR)/dsdrv/libtvcard.a: $(TVCARD_OBJS) $(AR) r $(BUILD_DIR)/dsdrv/libtvcard.a $(TVCARD_OBJS) .SUFFIXES: .c .o .tcl $(BUILD_DIR)/%.o: %.c $(CC) $(CFLAGS) -Wp,-MMD,$(BUILD_DIR)/deps.tmp -c -o $@ $< @sed -e "s#^[^ \t].*\.o:#$@:#" < $(BUILD_DIR)/deps.tmp > $@.dep && \ rm -f $(BUILD_DIR)/deps.tmp %.c: %.tcl $(BUILD_DIR)/tcl2c.exe $(BUILD_DIR)/tcl2c.exe -c -d -h $*.tcl $(BUILD_DIR)/%.c: %.tcl $(BUILD_DIR)/tcl2c.exe $(BUILD_DIR)/tcl2c.exe -c -d -h -p $(BUILD_DIR) $*.tcl .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))) # %.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 $(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)/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 | \ # grep '^........ [T] _' | sed 's/[^_]*_//' >> $@ # #libtk$(TCL_L).def: $(TCLDIR)/lib/libtk$(TCL_L).a # @echo EXPORTS > $@ # $(NM) $(TCLDIR)/lib/libtk$(TCL_L).a | \ # grep '^........ [T] _' | sed 's/[^_]*_//' >> $@ libtcl$(TCL_L).def libtk$(TCL_L).def: @echo "Tcl/Tk library .def files are missing - release is incomplete" @false $(BUILD_DIR): if [ ! -d $@ ] ; then \ mkdir $@; \ mkdir $@/epgvbi $@/epgdb $@/epgctl $@/epgui $@/epgtcl; \ mkdir $@/tvsim $@/dsdrv; \ fi .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; \ zip -9 -j $$ARCHIVE $(BUILD_DIR)/nxtvepg.exe; \ zip -9 $$ARCHIVE tcl$(TCL_L).dll tk$(TCL_L).dll dsdrv4.sys dsdrv4.vxd nxtvepg.ico; \ zip -9 $$ARCHIVE -l manual.html manual-de.html Nxtvepg.ad; \ for v in TODO README 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 # include dependencies (each object has one dependency file) -include $(BUILD_DIR)/*/*.dep # end Windows specific part / note more rules follow in UNIX Makefile