# GNUmakefile for VideoteXt # # Copyright (c) 1994-97 by Martin Buck # # $Id: Makefile,v 1.25 1999/10/04 23:23:40 mb Exp mb $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # 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. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # Set the installation-directories & permissions here #LIBDIR = /usr/local/lib/vtx #SPOOLDIR = /var/spool/vtx #BINDIR = /usr/local/bin #XBINDIR = /usr/local/bin/X11 #FONTDIR = /usr/lib/X11/fonts/local #MANDIR = /usr/local/man #XMANDIR = /usr/local/man SPOOLDIR = /var/spool/vtx LIBDIR = ${PREFIX}/lib/X11/vtx BINDIR = ${PREFIX}/bin XBINDIR = ${PREFIX}/bin FONTDIR = ${PREFIX}/lib/X11/fonts/local MANDIR = ${PREFIX}/man XMANDIR = ${PREFIX}/man DIRPERM = 755 SPOOLDIRPERM = 777 DATAPERM = 644 BINPERM = 755 BINGRP = BINDIRPERM = $(DIRPERM) BINDIRGRP = FONTPERM = $(DATAPERM) FONTGRP = FONTDIRPERM = $(DIRPERM) FONTDIRGRP = LIBPERM = $(DATAPERM) LIBGRP = LIBDIRPERM = $(DIRPERM) LIBDIRGRP = MANPERM = $(DATAPERM) MANGRP = MANDIRPERM = $(DIRPERM) MANDIRGRP = SPOOLDIRGRP = STRIP = -s # Compiler options INCLUDEDIRS = -I${X11BASE}/include LIBDIRS = -L${X11BASE}/lib CC ?= gcc CCFLAGS = -fomit-frame-pointer -pipe -Wall #-Wstrict-prototypes LDFLAGS = CLIBS = XLIBS = -lxview -lolgx -lX11 -lm # Comment out the next line if you want to disable GIF support. This might be # useful if you want to distribute VideoteXt and want to avoid trouble with # Unisys' stupid licensing conditions. GIF_SUPPORT = -DGIF_SUPPORT # Uncomment the next lines if you want PNG support and have libpng and libz # installed. PNG_SUPPORT = -DPNG_SUPPORT PNG_LIBS = -lpng -lz -lm PNG_INCLUDEDIRS = -I${LOCALBASE}/include PNG_LIBDIRS = -L${LOCALBASE}/lib # Uncomment the following line if you want to get coredumps when an # assertion fails. You should only do this if you want to debug VideoteXt # (see the comment in vtx_assert.h) #DEFINES += -DASSERT_DUMP_CORE # The next define works around a bug in the Linux kernel which gets triggered # when you try to load the vtx-driver with kerneld. I reported this bug some # time ago but it is still present as of Linux 2.0.30 and I fear it won't be # fixed in the next few releases :-( # If the bug is fixed in your kernel or you don't use kerneld at all, you # may comment out the next line, but leaving it uncommented shouldn't hurt, # either. DEFINES += -DNEED_KERNELD_WORKAROUND # Uncomment the next line if you plan to run VideoteXt on an SGI-X-Server # (from Irix 4 & 5). These servers hang if you use XView-programs. To prevent # this, either use the commandline-option '-fullscreendebug' or set the # resource 'Fullscreen.Debug: true'. Due to a XView-bug this resource will # be ignored sometimes. Uncomment the next line to work around this problem # (Note: the OS VideoteXt runs on doesn't matter -- the problem always shows # up when you use an SGI-X-Server) #DEFINES += -DNEED_FULLSCREEN_WORKAROUND # The next variables are used for some installation-targets. You should # fiddle around with them only if you really know what you're doing. # Normally, the defaults should be perfectly OK. MAGIC = /etc/magic VTXMAGIC = data/magic HOTLISTTMPL = data/vtx-hotlist BASESPOOLDIRPERM = 755 CRONTIME = 0 0 * * * CRONEXPIRE = 30 ##################################################################### # No user-servicable parts beyond this line! ##################################################################### DEFINES += -DVTX_LIBDIR=\"$(LIBDIR)\" -DVTX_SPOOLDIR=\"$(SPOOLDIR)\" CFLAGS += $(DEFINES) $(GIF_SUPPORT) $(PNG_SUPPORT) $(CCFLAGS) $(INCLUDEDIRS) $(PNG_INCLUDEDIRS) \ -I. -Ibitmaps $(XCFLAGS) LDFLAGS += $(XLDFLAGS) OBJS = cct.o vtxdecode.o vtxtools.o toptext.o safe_malloc.o fileio.o gifwrite.o postscript.o XOBJS = tilde.o hotlist.o vtxqueue.o cache.o config.o dialog.o spool.o fastext.o xvtools.o \ xevents.o xinit.o wmgr_deco.o search.o tuner.o tvchannels.o selection.o COBJS = vtxget.o batch.o TOBJS = tvchannels.o tuner.o tunerctl.o safe_malloc.o SRC = vtxget.c cct.c vtxdecode.c batch.c vtxtools.c safe_malloc.c tilde.c toptext.c hotlist.c \ vtxqueue.c cache.c config.c dialog.c spool.c fastext.c xvtools.c xevents.c xinit.c \ wmgr_deco.c fileio.c gifwrite.c postscript.c search.c tuner.c tunerctl.c tvchannels.c \ selection.c HEADERS = vtxget.h cct.h vtxdecode.h batch.h vtxtools.h safe_malloc.h tilde.h toptext.h hotlist.h \ vtxqueue.h cache.h config.h dialog.h spool.h fastext.h xvtools.h xevents.h xinit.h \ wmgr_deco.h fileio.h gifwrite.h postscript.h misc.h vtx_assert.h search.h tuner.h \ tvchannels.h selection.h EXECS = videotext vtxget tunerctl SCRIPTS = mkvtxfont mktitlepage mkpsprolog mkspooldirs \ install-magic uninstall-magic check-rcs check-help BITMAPS = empty.xbm checkmark_sheet.xbm checkmark_sheets.xbm clock.xbm eyes.xbm sheet.xbm \ eyes_sheet.xbm sheets.xbm \ pglayout_1_1.xbm pglayout_1_1l.xbm pglayout_1_2.xbm pglayout_2_1l.xbm pglayout_2_2.xbm \ pglayout_2_2l.xbm pglayout_2_3.xbm pglayout_3_2l.xbm pglayout_3_3l.xbm \ fg_found.xbm fg_nofound.xbm fg_read.xbm bg_found.xbm bg_nofound.xbm bg_read.xbm \ disk_found.xbm disk_nofound.xbm disk_read.xbm nodisk_found.xbm nodisk_nofound.xbm \ nodisk_read.xbm tvset.xbm vtx.xbm DATA = vtxrc vtx-hotlist tv-channels magic MISC = titlepage.raw psprolog.ps .depend Makefile MANPAGES = videotext.1 vtxget.1 tunerctl.1 MANSRC = videotext.1.in vtxget.1.in tunerctl.1.in # We use .xvinfo for XView-help-files, because GNU-make thinks .info stands for a GNU info-file # and thus cancels our .in-rule below. Sigh. HELP = videotext.xvinfo HELPSRC = videotext.xvinfo.in DOCS = README ChangeLog VideoteXt.lsm VTXCARD-VENDORS COPYING TODO FONTSIZES = 10x12 15x18 20x24 FONTSRC = $(foreach sz,$(FONTSIZES),fonts/vtx$(sz).pbm) PCFFONTS = $(foreach sz,$(FONTSIZES),fonts/vtx$(sz).pcf fonts/vtx$(sz)d.pcf) VTXFONTS = $(foreach sz,$(FONTSIZES),fonts/vtx$(sz).vtxfont) VERSION = 0.6.19991029 DISTDIR = videotext-$(VERSION) ifneq ($(BINGRP),) _BINGRP = -g $(BINGRP) endif ifneq ($(BINDIRGRP),) _BINDIRGRP = -g $(BINDIRGRP) endif ifneq ($(FONTGRP),) _FONTGRP = -g $(FONTGRP) endif ifneq ($(FONTDIRGRP),) _FONTDIRGRP = -g $(FONTDIRGRP) endif ifneq ($(LIBGRP),) _LIBGRP = -g $(LIBGRP) endif ifneq ($(LIBDIRGRP),) _LIBDIRGRP = -g $(LIBDIRGRP) endif ifneq ($(MANGRP),) _MANGRP = -g $(MANGRP) endif ifneq ($(MANDIRGRP),) _MANDIRGRP = -g $(MANDIRGRP) endif ifdef PROFILING CFLAGS += -pg LDFLAGS += -pg endif .PHONY: all fonts doc \ install install.videotext install.vtxget install.tunerctl install.xfonts install.fonts \ install.config install.forceconfig install.lib install.spooldirs install.cronjob \ uninstall uninstall.videotext uninstall.vtxget uninstall.tunerctl uninstall.xfonts \ uninstall.fonts uninstall.config uninstall.lib uninstall.spooldirs uninstall.cronjob \ tidy clean distclean dist rotw hotlist check_help check_rcs stats depend all: videotext vtxget tunerctl fonts doc videotext: $(OBJS) $(XOBJS) -rm -f $@ $(CC) $(LDFLAGS) -o $@ $^ $(LIBDIRS) $(PNG_LIBDIRS) $(PNG_LIBS) $(XLIBS) $(XXLIBS) vtxget: $(OBJS) $(COBJS) -rm -f $@ $(CC) $(LDFLAGS) -o $@ $^ $(LIBDIRS) $(PNG_LIBDIRS) $(PNG_LIBS) $(CLIBS) $(XCLIBS) tunerctl: $(TOBJS) -rm -f $@ $(CC) $(LDFLAGS) -o $@ $^ $(LIBDIRS) $(CLIBS) $(XCLIBS) titlepage.h: titlepage.raw -rm -f $@ ./scripts/mktitlepage < $< > $@ -chmod -w $@ psprolog.h: psprolog.ps -rm -f $@ ./scripts/mkpsprolog < $< > $@ -chmod -w $@ fonts: $(PCFFONTS) $(VTXFONTS) doc: $(MANPAGES) $(HELP) install: install.videotext install.vtxget install.tunerctl install.xfonts install.fonts \ install.config install.lib install.videotext: videotext videotext.1 $(HELP) -install -d $(_BINDIRGRP) -m $(BINDIRPERM) $(DESTDIR)$(XBINDIR) -install -d $(_MANDIRGRP) -m $(MANDIRPERM) $(DESTDIR)$(XMANDIR) \ $(DESTDIR)$(XMANDIR)/man1 -install -d $(_LIBDIRGRP) -m $(LIBDIRPERM) $(DESTDIR)$(LIBDIR) ${BSD_INSTALL_PROGRAM} videotext $(DESTDIR)$(XBINDIR) ${BSD_INSTALL_MAN} videotext.1 $(DESTDIR)$(XMANDIR)/man1 ${BSD_INSTALL_DATA} $(HELP) $(DESTDIR)$(LIBDIR)/videotext.info install.vtxget: vtxget vtxget.1 -install -d $(_BINDIRGRP) -m $(BINDIRPERM) $(DESTDIR)$(BINDIR) -install -d $(_MANDIRGRP) -m $(MANDIRPERM) $(DESTDIR)$(MANDIR) \ $(DESTDIR)$(MANDIR)/man1 ${BSD_INSTALL_PROGRAM} vtxget $(DESTDIR)$(BINDIR) ${BSD_INSTALL_MAN} vtxget.1 $(DESTDIR)$(MANDIR)/man1 install.tunerctl: tunerctl tunerctl.1 -install -d $(_BINDIRGRP) -m $(BINDIRPERM) $(DESTDIR)$(BINDIR) -install -d $(_MANDIRGRP) -m $(MANDIRPERM) $(DESTDIR)$(MANDIR) \ $(DESTDIR)$(MANDIR)/man1 ${BSD_INSTALL_PROGRAM} tunerctl $(DESTDIR)$(BINDIR) ${BSD_INSTALL_MAN} tunerctl.1 $(DESTDIR)$(MANDIR)/man1 install.xfonts: $(PCFFONTS) -install -d $(_FONTDIRGRP) -m $(FONTDIRPERM) $(DESTDIR)$(FONTDIR) ${BSD_INSTALL_DATA} $(PCFFONTS) $(DESTDIR)$(FONTDIR) mkfontdir $(DESTDIR)$(FONTDIR) -xset fp rehash install.fonts: $(VTXFONTS) -install -d $(_LIBDIRGRP) -m $(LIBDIRPERM) $(DESTDIR)$(LIBDIR) ${BSD_INSTALL_DATA} $(VTXFONTS) $(DESTDIR)$(LIBDIR) install.config: -install -d $(_LIBDIRGRP) -m $(LIBDIRPERM) $(DESTDIR)$(LIBDIR) ifeq ($(DESTDIR)$(LIBDIR)/vtxrc,$(wildcard $(DESTDIR)$(LIBDIR)/vtxrc)) @echo @echo Warning: $(DESTDIR)$(LIBDIR)/vtxrc already exists -- won\'t overwrite. @echo Do a \'make install.forceconfig\' to overwrite old version. @echo else ${BSD_INSTALL_DATA} data/vtxrc $(DESTDIR)$(LIBDIR) endif ifeq ($(DESTDIR)$(LIBDIR)/vtx-hotlist,$(wildcard $(DESTDIR)$(LIBDIR)/vtx-hotlist)) @echo @echo Warning: $(DESTDIR)$(LIBDIR)/vtx-hotlist already exists -- won\'t overwrite. @echo Please check data/vtx-hotlist and add new entries manually. @echo Or do a \'make install.forceconfig\' to overwrite old version. @echo else ${BSD_INSTALL_DATA} data/vtx-hotlist $(DESTDIR)$(LIBDIR) endif install.forceconfig: -install -d $(_LIBDIRGRP) -m $(LIBDIRPERM) $(DESTDIR)$(LIBDIR) ${BSD_INSTALL_DATA} data/vtxrc data/vtx-hotlist $(DESTDIR)$(LIBDIR) install.lib: -install -d $(_LIBDIRGRP) -m $(LIBDIRPERM) $(DESTDIR)$(LIBDIR) ${BSD_INSTALL_DATA} data/tv-channels $(DESTDIR)$(LIBDIR) install.spooldirs: -install -d -m $(BASESPOOLDIRPERM) $(DESTDIR)$(SPOOLDIR) ./scripts/mkspooldirs "$(HOTLISTTMPL)" "$(DESTDIR)$(SPOOLDIR)" \ "$(SPOOLDIRPERM)" "$(SPOOLDIRGRP)" install.cronjob: -crontab -l | grep -v "find $(SPOOLDIR)" > /tmp/vtx_crontab echo "$(CRONTIME) find $(SPOOLDIR) -type f -mtime +$(CRONEXPIRE) -print0 | xargs -r -0 rm" >> /tmp/vtx_crontab crontab /tmp/vtx_crontab -rm -f /tmp/vtx_crontab install.magic: uninstall.magic ./scripts/install-magic "$(DESTDIR)$(MAGIC)" "$(VTXMAGIC)" uninstall: uninstall.videotext uninstall.vtxget uninstall.tunerctl uninstall.xfonts \ uninstall.fonts uninstall.config uninstall.lib uninstall.videotext: -rm -f $(DESTDIR)$(XBINDIR)/videotext $(DESTDIR)$(XMANDIR/man1/videotext.1 \ $(DESTDIR)$(LIBDIR)/videotext.info uninstall.vtxget: -rm -f $(DESTDIR)$(BINDIR)/vtxget $(DESTDIR)$(MANDIR)/man1/vtxget.1 uninstall.tunerctl: -rm -f $(DESTDIR)$(BINDIR)/tunerctl $(DESTDIR)$(MANDIR)/man1/tunerctl.1 uninstall.xfonts: -for font in $(PCFFONTS); do rm -f $(DESTDIR)$(FONTDIR)/$$font; done -ls $(DESTDIR)$(FONTDIR) | grep -v 'fonts\.dir' > /dev/null && \ rm -f $(DESTDIR)$(FONTDIR)/fonts.dir uninstall.fonts: -for font in $(FONTS); do rm -f $(DESTDIR)$(LIBDIR)/$$font; done uninstall.config: -rm -f $(DESTDIR)$(LIBDIR)/vtxrc $(DESTDIR)$(LIBDIR)/vtx-hotlist uninstall.lib: -rm -f $(DESTDIR)$(LIBDIR)/tv-channels uninstall.spooldirs: -rm -fr $(DESTDIR)$(SPOOLDIR) uninstall.cronjob: -crontab -l | grep -v "find $(SPOOLDIR)" > /tmp/vtx_crontab && crontab /tmp/vtx_crontab -rm -f /tmp/vtx_crontab uninstall.magic: ./scripts/uninstall-magic "$(DESTDIR)$(MAGIC)" tidy: -rm -f core gmon.out *~ clean: tidy -rm -f $(OBJS) $(COBJS) $(XOBJS) $(TOBJS) titlepage.h psprolog.h $(HELP) $(MANPAGES) distclean: clean -rm -f $(EXECS) $(VTXFONTS) $(PCFFONTS) dist: depend #check_help -rm -fr $(DISTDIR) mkdir $(DISTDIR) $(DISTDIR)/fonts $(DISTDIR)/bitmaps $(DISTDIR)/examples \ $(DISTDIR)/scripts $(DISTDIR)/data $(DISTDIR)/driver cp -a $(SRC) $(HEADERS) $(MISC) $(HELPSRC) $(MANSRC) $(DOCS) \ examples sys $(DISTDIR) rm -fr $(DISTDIR)/examples/RCS cd scripts && cp -a $(SCRIPTS) ../$(DISTDIR)/scripts cd data && cp -a $(DATA) ../$(DISTDIR)/data cd bitmaps && cp -a $(BITMAPS) ../$(DISTDIR)/bitmaps cp -a $(FONTSRC) $(DISTDIR)/fonts sed -e 's/^#define VTXVERSION .*$$/#define VTXVERSION "$(VERSION)"/g' misc.h > $(DISTDIR)/misc.h sed -e 's/^VERSION = .*$$/VERSION = $(VERSION)/g' Makefile > $(DISTDIR)/Makefile $(MAKE) -C driver DISTDIR=$(DISTDIR) sub-dist chmod -R u=rwX,go=rX $(DISTDIR)/ tar cf - $(DISTDIR) | gzip -9 > $(DISTDIR).tar.gz rm -fr $(DISTDIR) dist-beta: $(MAKE) VERSION=$(VERSION).$(shell date '+%Y%m%d') dist hotlist: $(HOME)/.vtx-hotlist echo "# Default hotlist for VideoteXt, created from $(HOME)/.vtx-hotlist" > data/vtx-hotlist echo "# on `date`" >> data/vtx-hotlist sed -e '/^\([0-9]\+\|#.*\|search_str=.*\|search_flags=.*\)$$/d' \ -e 's/^\(channel\)=.*$$/\1=/g' \ -e 's/^\(frequency\|program\)=.*$$/\1=0/g' \ $(HOME)/.vtx-hotlist >> data/vtx-hotlist check_help: videotext.info $(SRC) @./scripts/check-help videotext.info $(SRC) check_rcs: @./scripts/check-rcs stats: @cat *.c *.h driver/*.c driver/*.h | wc depend: titlepage.h psprolog.h $(CC) -c -MM $(CFLAGS) $(SRC) > .depend %.bdf %d.bdf %.vtxfont: %.pbm -rm -f $@ ./scripts/mkvtxfont $*.pbm $*.bdf $*d.bdf $*.vtxfont -chmod -w $*.bdf $*d.bdf $*.vtxfont %.pcf: %.bdf -rm -f $@ bdftopcf $< > $@ -chmod -w $@ %: %.in -rm -f $@ sed -e 's;@SPOOLDIR@;$(SPOOLDIR);g' -e 's;@LIBDIR@;$(LIBDIR);g' \ -e 's;@VERSION@;$(VERSION);g' < $< > $@ -chmod -w $@ ifeq (.depend,$(wildcard .depend)) include .depend endif