diff options
-rw-r--r-- | .cvsignore | 5 | ||||
-rw-r--r-- | GNUmakefile | 91 | ||||
-rw-r--r-- | Makefile | 62 | ||||
-rw-r--r-- | VERSION | 1 | ||||
-rwxr-xr-x | fallback.pl | 26 | ||||
-rw-r--r-- | mk/.cvsignore | 1 | ||||
-rw-r--r-- | mk/Autoconf.mk | 138 | ||||
-rw-r--r-- | mk/Compile.mk | 88 | ||||
-rw-r--r-- | mk/Maintainer.mk | 12 | ||||
-rw-r--r-- | mk/Variables.mk | 46 | ||||
-rw-r--r-- | xmover.ad | 137 |
11 files changed, 545 insertions, 62 deletions
diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..ad5c62b --- /dev/null +++ b/.cvsignore @@ -0,0 +1,5 @@ +Make.config +mover +xmover +autojuke +unload diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..b2c62c1 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,91 @@ +# config +srcdir = . +VPATH = $(srcdir) +-include Make.config +include $(srcdir)/mk/Variables.mk + +resdir = $(DESTDIR)$(RESDIR) + +# fixup flags +CFLAGS += -DVERSION='"$(VERSION)"' -I$(srcdir) + +# default target +all: build + +# what to build +TARGETS := mover autojuke unload +ifeq ($(HAVE_MOTIF),yes) + TARGETS += xmover +endif + + +################################################################# +# poor man's autoconf ;-) + +include $(srcdir)/mk/Autoconf.mk + +define make-config +LIB := $(LIB) +RESDIR := $(call ac_resdir) +HAVE_MOTIF := $(call ac_lib,XmStringGenerate,Xm,-L/usr/X11R6/$(LIB) -lXpm -lXt -lXext -lX11) +endef + +# for X11 + Motif +xmover : CFLAGS += -I/usr/X11R6/include +xmover : LDFLAGS += -L/usr/X11R6/$(LIB) +xmover : LDLIBS += -lXm -lXpm -lXt -lXext -lX11 + +# RegEdit.c is good old K&R ... +RegEdit.o : CFLAGS += -Wno-missing-prototypes -Wno-strict-prototypes + + +######################################################################## +# targets + +unload: unload.o + +mover: mover.o + +xmover: xmover.o man.o RegEdit.o + +xmover.o: xmover.c xmover.h + +xmover.h: xmover.ad $(srcdir)/fallback.pl + perl $(srcdir)/fallback.pl < $< > $@ + +load: unload + ln -s unload load + + +######################################################################## +# general rules + +.PHONY: build install clean distclean realclean +build: $(TARGETS) + +install: build + $(INSTALL_DIR) $(bindir) + $(INSTALL_DIR) $(mandir)/man1 + $(INSTALL_DIR) $(mandir)/man8 + $(INSTALL_BINARY) $(TARGETS) $(bindir) + $(INSTALL_DATA) $(srcdir)/mover.man $(mandir)/man1/mover.1 + $(INSTALL_DATA) $(srcdir)/xmover.man $(mandir)/man1/xmover.1 + $(INSTALL_DATA) $(srcdir)/autojuke.man $(mandir)/man8/autojuke.8 + $(INSTALL_DATA) -m644 autojuke.conf $(etc) + +clean: + -rm -f *.o $(depfiles) core core.* + +realclean distclean: clean + -rm -f Make.config + -rm -f $(TARGETS) *~ rd/*~ wr/*~ xpm/*~ Ida.ad.h logo.h + +include $(srcdir)/mk/Compile.mk +-include $(depfiles) + + +######################################################################## +# maintainer stuff + +include $(srcdir)/mk/Maintainer.mk + diff --git a/Makefile b/Makefile deleted file mode 100644 index 707a0c8..0000000 --- a/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -DESTDIR = -prefix = /usr/local - -etc = $(DESTDIR)/etc -bindir = $(DESTDIR)$(prefix)/bin -sbindir = $(DESTDIR)$(prefix)/sbin -mandir = $(DESTDIR)$(prefix)/share/man - -RELEASE := $(shell uname -r) -KINC := /lib/modules/$(RELEASE)/build/include -#KINC := /usr/src/linux/include - -XINC := /usr/X11R6/include -XLIB := /usr/X11R6/lib - -CC := gcc -OPTFLAGS:= -O2 -CFLAGS := -Wall -g $(OPTFLAGS) -#CFLAGS += -I$(KINC) -CFLAGS += -I$(XINC) -L$(XLIB) - -VERSION := 0.20 -PROGS := mover autojuke - -# poor man's autoconf :-) -MOTIF := $(shell test -d $(XINC)/Xm && echo "yes") -ifeq ($(MOTIF),yes) -PROGS += xmover -endif - -% : %.c - $(CC) $(CFLAGS) -o $@ $< - -all: $(PROGS) - -xmover: xmover.o man.o RegEdit.o - $(CC) $(CFLAGS) -o $@ $^ -lXm -lXt -lX11 - -xmover.o: xmover.c xmover.h - -xmover.h: xmover.ad - perl fallback.pl < $< > $@ - -load: unload - ln -s unload load - -clean: - rm -f *.o *~ $(PROGS) load - -install: $(PROGS) - mkdir -p $(etc) $(bindir) $(sbindir) - mkdir -p $(mandir)/man1 $(mandir)/man8 - install -s -m755 mover $(bindir) - install -m644 mover.man $(mandir)/man1/mover.1 - install -s -m755 autojuke $(sbindir) - install -m644 autojuke.man $(mandir)/man8/autojuke.8 - install -m644 autojuke.conf $(etc) -ifeq ($(MOTIF),yes) - install -s -m755 xmover $(bindir) - install -m644 xmover.man $(mandir)/man1/xmover.1 -endif - @@ -0,0 +1 @@ +0.21 diff --git a/fallback.pl b/fallback.pl new file mode 100755 index 0000000..03706c4 --- /dev/null +++ b/fallback.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl -w +# +# build header file from +# +use strict; + +while (my $line = <>) { + chomp $line; + + # ignore comments + next if $line =~ /^!/; +# next if $line =~ /^\s*$/; + + # quote stuff + $line =~ s/\\/\\\\/g; + $line =~ s/\"/\\\"/g; + + # continued line? + if ($line =~ s/\\\\$//) { + printf "\"%s\"\n",$line; + next; + } + + # write out + printf "\"%s\",\n",$line; +} diff --git a/mk/.cvsignore b/mk/.cvsignore new file mode 100644 index 0000000..4985818 --- /dev/null +++ b/mk/.cvsignore @@ -0,0 +1 @@ +*.dep diff --git a/mk/Autoconf.mk b/mk/Autoconf.mk new file mode 100644 index 0000000..4d25d21 --- /dev/null +++ b/mk/Autoconf.mk @@ -0,0 +1,138 @@ +# +# simple autoconf system for GNU make +# +# (c) 2002-2004 Gerd Knorr <kraxel@bytesex.org> +# +# credits for creating this one go to the autotools people because +# they managed it to annoy lots of developers and users (including +# me) with version incompatibilities. +# +# This file is public domain. No warranty. If it breaks you keep +# both pieces. +# +######################################################################## + +# verbose yes/no +verbose ?= no + +# some stuff used by the tests +ifneq ($(verbose),no) + # verbose (for debug) + ac_init = echo "checking $(1) ... " >&2; rc=no + ac_b_cmd = echo "run: $(1)" >&2; $(1) >/dev/null && rc=yes + ac_s_cmd = echo "run: $(1)" >&2; rc=`$(1)` + ac_fini = echo "... result is $${rc}" >&2; echo >&2; echo "$${rc}" +else + # normal + ac_init = echo -n "checking $(1) ... " >&2; rc=no + ac_b_cmd = $(1) >/dev/null 2>&1 && rc=yes + ac_s_cmd = rc=`$(1) 2>/dev/null` + ac_fini = echo "$${rc}" >&2; echo "$${rc}" +endif + +# some helpers to build cflags and related variables +ac_def_cflags_1 = $(if $(filter yes,$($(1))),-D$(1)) +ac_lib_cflags = $(foreach lib,$(1),$(call ac_def_cflags_1,HAVE_LIB$(lib))) +ac_inc_cflags = $(foreach inc,$(1),$(call ac_def_cflags_1,HAVE_$(inc))) +ac_lib_mkvar_1 = $(if $(filter yes,$(HAVE_LIB$(1))),$($(1)_$(2))) +ac_lib_mkvar = $(foreach lib,$(1),$(call ac_lib_mkvar_1,$(lib),$(2))) + + +######################################################################## +# the tests ... + +# get uname +ac_uname = $(shell \ + $(call ac_init,for system);\ + $(call ac_s_cmd,uname -s | tr 'A-Z' 'a-z');\ + $(call ac_fini)) + +# check for some header file +# args: header file +ac_header = $(shell \ + $(call ac_init,for $(1));\ + $(call ac_b_cmd,echo '\#include <$(1)>' |\ + $(CC) $(CFLAGS) -E -);\ + $(call ac_fini)) + +# check for some function +# args: function [, additional libs ] +ac_func = $(shell \ + $(call ac_init,for $(1));\ + echo 'void $(1)(void); int main(void) {$(1)();return 0;}' \ + > __actest.c;\ + $(call ac_b_cmd,$(CC) $(CFLAGS) $(LDFLAGS) -o \ + __actest __actest.c $(2));\ + rm -f __actest __actest.c;\ + $(call ac_fini)) + +# check for some library +# args: function, library [, additional libs ] +ac_lib = $(shell \ + $(call ac_init,for $(1) in $(2));\ + echo 'void $(1)(void); int main(void) {$(1)();return 0;}' \ + > __actest.c;\ + $(call ac_b_cmd,$(CC) $(CFLAGS) $(LDFLAGS) -o \ + __actest __actest.c -l$(2) $(3));\ + rm -f __actest __actest.c;\ + $(call ac_fini)) + +# check if some compiler flag works +# args: compiler flag +ac_cflag = $(shell \ + $(call ac_init,if $(CC) supports $(1));\ + echo 'int main() {return 0;}' > __actest.c;\ + $(call ac_b_cmd,$(CC) $(CFLAGS) $(1) $(LDFLAGS) -o \ + __actest __actest.c);\ + rm -f __actest __actest.c;\ + $(call ac_fini)) + +# check for some binary +# args: binary name +ac_binary = $(shell \ + $(call ac_init,for $(1));\ + $(call ac_s_cmd,which $(1));\ + bin="$$rc";rc="no";\ + $(call ac_b_cmd,test -x "$$$$bin");\ + $(call ac_fini)) + +# check if lib64 is used +ac_lib64 = $(shell \ + $(call ac_init,for libdir name);\ + $(call ac_s_cmd,$(CC) -print-search-dirs | grep -q lib64 &&\ + echo "lib64" || echo "lib");\ + $(call ac_fini)) + +# check for x11 ressource dir prefix +ac_resdir = $(shell \ + $(call ac_init,for X11 app-defaults prefix);\ + $(call ac_s_cmd, test -d /etc/X11/app-defaults &&\ + echo "/etc/X11" || echo "/usr/X11R6/lib/X11");\ + $(call ac_fini)) + + +######################################################################## +# build Make.config + +define newline + + +endef +make-config-q = $(subst $(newline),\n,$(make-config)) + +ifeq ($(filter config,$(MAKECMDGOALS)),config) +.PHONY: Make.config + LIB := $(call ac_lib64) +else + LIB ?= $(call ac_lib64) + LIB := $(LIB) +endif +.PHONY: config +config: Make.config + @true + +Make.config: $(srcdir)/GNUmakefile + @echo -e "$(make-config-q)" > $@ + @echo + @echo "Make.config written, edit if needed" + @echo diff --git a/mk/Compile.mk b/mk/Compile.mk new file mode 100644 index 0000000..49dddbf --- /dev/null +++ b/mk/Compile.mk @@ -0,0 +1,88 @@ +# +# some rules to compile stuff ... +# +# (c) 2002-2004 Gerd Knorr <kraxel@bytesex.org> +# +# main features: +# * autodependencies via "cpp -MD" +# * fancy, non-verbose output +# +# This file is public domain. No warranty. If it breaks you keep +# both pieces. +# +######################################################################## + +# verbose yes/no +verbose ?= no + +# dependency files +tmpdep = mk/$(subst /,_,$*).tmp +depfile = mk/$(subst /,_,$*).dep +depfiles = mk/*.dep + +compile_c = $(CC) $(CFLAGS) -Wp,-MD,$(tmpdep) -c -o $@ $< +compile_cc = $(CXX) $(CXXFLAGS) -Wp,-MD,$(tmpdep) -c -o $@ $< +fixup_deps = sed -e "s|.*\.o:|$@:|" < $(tmpdep) > $(depfile) && rm -f $(tmpdep) +cc_makedirs = mkdir -p $(dir $@) $(dir $(depfile)) + +link_app = $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) +link_so = $(CC) $(LDFLAGS) -shared -Wl,-soname,$(@F) -o $@ $^ $(LDLIBS) +ar_lib = rm -f $@ && ar -r $@ $^ && ranlib $@ + +moc_h = $(MOC) $< -o $@ +msgfmt_po = msgfmt -o $@ $< + +# non-verbose output +ifeq ($(verbose),no) + echo_compile_c = echo " CC " $@ + echo_compile_cc = echo " CXX " $@ + echo_link_app = echo " LD " $@ + echo_link_so = echo " LD " $@ + echo_ar_lib = echo " AR " $@ + echo_moc_h = echo " MOC " $@ + echo_msgfmt_po = echo " MSGFMT " $@ +else + echo_compile_c = echo $(compile_c) + echo_compile_cc = echo $(compile_cc) + echo_link_app = echo $(link_app) + echo_link_so = echo $(link_so) + echo_ar_lib = echo $(ar_lib) + echo_moc_h = echo $(moc_h) + echo_msgfmt_po = echo $(msgfmt_po) +endif + +%.o: %.c + @$(cc_makedirs) + @$(echo_compile_c) + @$(compile_c) + @$(fixup_deps) + +%.o: %.cc + @$(cc_makedirs) + @$(echo_compile_cc) + @$(compile_cc) + @$(fixup_deps) + +%.o: %.cpp + @$(cc_makedirs) + @$(echo_compile_cc) + @$(compile_cc) + @$(fixup_deps) + + +%.so: %.o + @$(echo_link_so) + @$(link_so) + +%: %.o + @$(echo_link_app) + @$(link_app) + +%.moc : %.h + @$(echo_moc_h) + @$(moc_h) + +%.mo : %.po + @$(echo_msgfmt_po) + @$(msgfmt_po) + diff --git a/mk/Maintainer.mk b/mk/Maintainer.mk new file mode 100644 index 0000000..5bf9480 --- /dev/null +++ b/mk/Maintainer.mk @@ -0,0 +1,12 @@ +# just some maintainer stuff for me ... +######################################################################## + +make-sync-dir = $(HOME)/src/gnu-make + +.PHONY: sync +sync:: distclean + test -d $(make-sync-dir) + rm -f $(srcdir)/INSTALL $(srcdir)/mk/*.mk + cp -v $(make-sync-dir)/INSTALL $(srcdir)/. + cp -v $(make-sync-dir)/*.mk $(srcdir)/mk + chmod 444 $(srcdir)/INSTALL $(srcdir)/mk/*.mk diff --git a/mk/Variables.mk b/mk/Variables.mk new file mode 100644 index 0000000..930f824 --- /dev/null +++ b/mk/Variables.mk @@ -0,0 +1,46 @@ +# common variables ... +######################################################################## + +# directories +DESTDIR = +srcdir ?= . +prefix ?= /usr/local +bindir = $(DESTDIR)$(prefix)/bin +mandir = $(DESTDIR)$(prefix)/share/man +locdir = $(DESTDIR)$(prefix)/share/locale + +# package + version +empty := +space := $(empty) $(empty) +ifneq ($(wildcard $(srcdir)/VERSION),) + VERSION := $(shell cat $(srcdir)/VERSION) +else + VERSION := 42 +endif + +# programs +CC ?= gcc +CXX ?= g++ +MOC ?= $(if $(QTDIR),$(QTDIR)/bin/moc,moc) +INSTALL ?= install +INSTALL_BINARY := $(INSTALL) -s +INSTALL_SCRIPT := $(INSTALL) +INSTALL_DATA := $(INSTALL) -m 644 +INSTALL_DIR := $(INSTALL) -d + +# cflags +CFLAGS ?= -g -O2 +CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes \ + -Wpointer-arith -Wunused + +# add /usr/local to the search path if something is in there ... +ifneq ($(wildcard /usr/local/include/*.h),) + CFLAGS += -I/usr/local/include + LDFLAGS += -L/usr/local/$(LIB) +endif + +# fixup include path for $(srcdir) != "." +ifneq ($(srcdir),.) + CFLAGS += -I. -I$(srcdir) +endif + diff --git a/xmover.ad b/xmover.ad new file mode 100644 index 0000000..8ed5efe --- /dev/null +++ b/xmover.ad @@ -0,0 +1,137 @@ +! general +xmover.geometry: 400x500 +xmover.deleteResponse: DO_NOTHING +xmover*XmDialogShell.deleteResponse: DESTROY + +! render tables +*renderTable: error,full,voltag +*renderTable.fontType: FONT_IS_FONTSET +*renderTable.fontName: \ + -*-helvetica-medium-r-normal--*-120-*-*-*-*, \ + -*-*-*-r-normal--*-120-*-*-*-* +*renderTable.error.renditionForeground: darkred +*renderTable.error.fontType: FONT_IS_FONTSET +*renderTable.error.fontName: \ + -*-helvetica-bold-r-normal--*-120-*-*-*-*, \ + -*-*-*-r-normal--*-120-*-*-*-* +*renderTable.full.renditionForeground: darkgreen +*renderTable.full.fontType: FONT_IS_FONTSET +*renderTable.full.fontName: \ + -*-helvetica-bold-r-normal--*-120-*-*-*-*, \ + -*-*-*-r-normal--*-120-*-*-*-* +*renderTable.voltag.fontType: FONT_IS_FONTSET +*renderTable.voltag.fontName: \ + -*-fixed-medium-r-normal--*-120-*-*-*-*, \ + -*-*-*-r-normal--*-120-*-*-*-* + +! arrange widgets +xmover.form.?.leftAttachment: ATTACH_FORM +xmover.form.?.rightAttachment: ATTACH_FORM +xmover.form.ie.topAttachment: ATTACH_WIDGET +xmover.form.ie.topWidget: bar +xmover.form.dt.topAttachment: ATTACH_WIDGET +xmover.form.dt.topWidget: ie +xmover.form.st.topAttachment: ATTACH_WIDGET +xmover.form.st.topWidget: dt +xmover.form.st.bottomAttachment: ATTACH_FORM +xmover.form.tool.leftOffset: 5 +xmover.form.tool.rightOffset: 5 +xmover.form.XmFrame.leftOffset: 5 +xmover.form.XmFrame.rightOffset: 5 +xmover.form.XmFrame.topOffset: 5 +xmover.form.XmFrame.bottomOffset: 5 + +! configure widgets +xmover.form.XmFrame.marginWidth: 5 +xmover.form.XmFrame.marginHeight: 5 +xmover.form.XmFrame.label.frameChildType: FRAME_TITLE_CHILD + +xmover.form.*.rc.packing: PACK_COLUMN +xmover.form.*.rc.orientation: VERTICAL +xmover.form.*.rc.resizeHeight: True +xmover.form.*.rc.numColumns: 1 +xmover.form.*.scroll.visualPolicy: CONSTANT +xmover.form.*.scroll.scrollingPolicy: AUTOMATIC +xmover.form.*.scroll.scrollBarDisplayPolicy: AS_NEEDED +xmover.form.*.scroll.scrollBarPlacement: BOTTOM_RIGHT + +xmover.form.*.rc.d.background: gray95 +xmover.form.*.rc.d.marginWidth: 0 +xmover.form.*.rc.d.marginHeight: 0 +xmover.form.*.rc.d.XmLabel.background: gray95 +xmover.form.*.rc.d.XmLabel.borderWidth: 0 +xmover.form.*.rc.d.XmLabel.marginLeft: 5 +xmover.form.*.rc.d.XmLabel.marginRight: 5 + +! strings +xmover.title: xmover +xmover*ie.label.labelString: Import/export elements (mailslot) +xmover*dt.label.labelString: Data transfer elements (drives) +xmover*st.label.labelString: Storage elements (slots) +xmover*menu.ref.labelString: Reload status +xmover*menu.src.labelString: Move back volume +xmover*menu.tag.labelString: Edit volume tag + +! menubar +xmover*bar.file.labelString: File +xmover*bar.file.mnemonic: F +xmover*bar.changer.labelString: Media changer +xmover*bar.changer.mnemonic: M +xmover*bar.help.labelString: Help +xmover*bar.help.mnemonic: H + +! menu file +xmover*bar*quit.labelString: Quit +xmover*bar*quit.mnemonic: Q +xmover*bar*quit.acceleratorText: Q +xmover*bar*quit.accelerator: <Key>Q + +! menu changer +xmover*bar*refresh.labelString: Reload status for all elements +xmover*bar*refresh.mnemonic: R +xmover*bar*refresh.acceleratorText: Ctrl+L +xmover*bar*refresh.accelerator: Ctrl<Key>L + +! menu help +xmover*bar*man.labelString: Manual page ... +xmover*bar*man.mnemonic: M +xmover*bar*man.acceleratorText: F1 +xmover*bar*man.accelerator: <Key>F1 +xmover*bar*about.labelString: About ... + +! popups +xmover.errbox_popup.title: Errors +xmover*tag_popup.title: Volume tag +xmover*tag_popup*selectionLabelString: New volume tag? +xmover*aboutbox_popup.title: About xmover +xmover*aboutbox_popup*messageString: \ + xmover - X11 frontend for scsi media changers\n\ + \n\ + (c) 2002 Gerd Knorr <kraxel@bytesex.org> + +!--------------------------------------------------------------------------- +! man-page renderer +xmover*man_popup.title: Manual page +xmover*man_popup*okLabelString: close window +xmover*man_popup*label.labelString: please wait ... + +xmover*man_popup.deleteResponse: DESTROY +xmover*man_popup*view.width: 500 +xmover*man_popup*view.height: 600 +xmover*man_popup*view.scrollingPolicy: AUTOMATIC +xmover*man_popup*view.scrollBarPlacement: BOTTOM_RIGHT + +xmover*man_popup*label.alignment: ALIGNMENT_BEGINNING +xmover*man_popup*label.marginWidth: 5 +xmover*man_popup*label.marginHeight: 5 +xmover*man_popup*label.renderTable: bold,underline +xmover*man_popup*label.renderTable.fontType: FONT_IS_FONTSET +xmover*man_popup*label.renderTable.fontName: \ + -*-fixed-medium-r-normal--13-*-*-*-*-*, + -*-*-*-r-normal--*-120-*-*-*-* + +xmover*man_popup*label.renderTable.bold.fontType: FONT_IS_FONTSET +xmover*man_popup*label.renderTable.bold.fontName: \ + -*-fixed-bold-r-normal--13-*-*-*-*-*, + -*-*-*-r-normal--*-120-*-*-*-* +xmover*man_popup*label.renderTable.underline.underlineType: SINGLE_LINE |