From e1839599f3e05e8bfb9e7da07001cdeed4cf7fde Mon Sep 17 00:00:00 2001 From: cvs Date: Mon, 25 Aug 2003 14:28:19 +0000 Subject: [PATCH] objects may now be separated from sources M.Z. SKIPPED: psi/make_gen psi/makefile psi/makefile_alpha psi/makefile_linux psi/hardsup/make_gen psi/hardsup/makefile psi/hardsup/makefile_alpha psi/hardsup/makefile_linux psi/tecs/make_gen psi/tecs/makefile psi/tecs/makefile_linux --- alpha_def | 2 +- dummy/make_gen | 8 +++-- dummy/makefile | 6 ++++ dummy/makefile_alpha_dummy | 7 ++-- dummy/makefile_linux_dummy | 11 +++--- linux_def | 2 +- make_forward | 68 +++++++++++++++++++++++++++++++++++++ make_gen | 17 ++++------ make_gen_dummy | 19 +++++------ makefile | 8 +++++ makefile_alpha | 16 ++++----- makefile_alpha_dummy | 27 ++++----------- makefile_linux | 6 ++-- makefile_linux_dummy | 16 ++++----- maketree | 32 +++++++++++++++++ matrix/make_gen | 2 ++ matrix/makefile | 8 +++++ matrix/makefile_alpha_dummy | 2 ++ matrix/makefile_linux | 2 +- matrix/makefile_linux_dummy | 17 ++-------- o2t.h | 1 - 21 files changed, 181 insertions(+), 96 deletions(-) create mode 100644 dummy/makefile create mode 100644 make_forward create mode 100644 makefile create mode 100755 maketree create mode 100644 matrix/makefile create mode 100644 matrix/makefile_alpha_dummy diff --git a/alpha_def b/alpha_def index 7a166bfa..7c6d655f 100644 --- a/alpha_def +++ b/alpha_def @@ -9,7 +9,7 @@ #FORTIFYOBJ=strdup.o fortify.o #----------------select proper Makefile -MFLAGS= -f makefile_alpha +MFLAGS= -f $(SRC)makefile_alpha$(DUMMY) SRC=$(SRC) #------------- path to HDF installation HDFROOT=/data/lnslib diff --git a/dummy/make_gen b/dummy/make_gen index d57a7839..9d68b3ed 100644 --- a/dummy/make_gen +++ b/dummy/make_gen @@ -6,15 +6,17 @@ .SUFFIXES: .SUFFIXES: .c .o .f +VPATH=$(SRC) + OBJ=dummy.o all: libdummy.a libdummy.a: $(OBJ) - - rm libdummy.a + rm -f libdummy.a ar cr libdummy.a $(OBJ) ranlib libdummy.a clean: - - rm *.a - - rm *.o \ No newline at end of file + rm -f *.a + rm -f *.o diff --git a/dummy/makefile b/dummy/makefile new file mode 100644 index 00000000..20314656 --- /dev/null +++ b/dummy/makefile @@ -0,0 +1,6 @@ +# this makefile delegates to a version specific makefile + +# where this subdirectory is (relative to the sics root) +S_DOWN=dummy + +include ../make_forward diff --git a/dummy/makefile_alpha_dummy b/dummy/makefile_alpha_dummy index dbca2ef0..d229f7bf 100644 --- a/dummy/makefile_alpha_dummy +++ b/dummy/makefile_alpha_dummy @@ -4,11 +4,10 @@ # # Mark Koennecke, June 2003 #-------------------------------------------------------------------------- -# the following line only for fortified version -#DFORTIFY=-DFORTIFY -#========================================================================== CC = cc -CFLAGS = -std1 -g $(DFORTIFY) -I.. +CFLAGS = -std1 -g $(DFORTIFY) -I$(SRC).. +DUMMY=_dummy +include ../alpha_def include make_gen diff --git a/dummy/makefile_linux_dummy b/dummy/makefile_linux_dummy index c745f917..70731ab5 100644 --- a/dummy/makefile_linux_dummy +++ b/dummy/makefile_linux_dummy @@ -1,14 +1,13 @@ #--------------------------------------------------------------------------- # Makefile for the Dummy specific part of SICS -# machine-dependent part for Tru64 Unix +# machine-dependent part for Redhat Linux with AFS at PSI # # Mark Koennecke, June 2003 #-------------------------------------------------------------------------- -# the following line only for fortified version -#DFORTIFY=-DFORTIFY -#========================================================================== CC = gcc -CFLAGS = -g $(DFORTIFY) -I.. +CFLAGS = -g $(DFORTIFY) -I../$(SRC) -include make_gen +DUMMY=_dummy +include ../$(SRC)linux_def +include $(SRC)make_gen diff --git a/linux_def b/linux_def index 9c00e28c..bcaf6b79 100644 --- a/linux_def +++ b/linux_def @@ -7,6 +7,6 @@ #DFORTIFY= -DFORTIFY #FORTIFYOBJ= fortify.o strdup.o -MFLAGS= -f makefile_linux +MFLAGS=-f $(SRC)makefile_linux$(DUMMY) SRC=$(SRC) HDFROOT=/afs/.psi.ch/project/sinq/linux diff --git a/make_forward b/make_forward new file mode 100644 index 00000000..88d5ac21 --- /dev/null +++ b/make_forward @@ -0,0 +1,68 @@ +# This file is included by the makefile. +# It forwards the execution to a version specific makefile. +# S_DOWN, S_UP and SICS_VERSION must be defined +# M. Zolliker 08.2003 + +VERS_UNDEFINED= +VERS_UNDEFINED$(SICS_VERSION)=version_undefined + +SICS_ROOT=$(PWD)/$(S_UP) +MD=cd $(SICS_ROOT)/obj/$(SICS_VERSION)/$(S_DOWN); \ + make -f $(SRC)makefile_$(SICS_VERSION) SRC=$(SRC) + +# overwrite MD when SICS_VERSION undefined +MD$(SICS_VERSION)=@ true + +SRC=src/ + +.SUFFIXES: .none + +default: $(VERS_UNDEFINED) + $(MD) + +%.o: $(VERS_UNDEFINED) + $(MD) $@ + +%: $(VERS_UNDEFINED) + $(MD) $@ + +.DEFAULT: $(VERS_UNDEFINED) + $(MD) $@ + +tree: + @ $(SICS_ROOT)/maketree . + @ $(SICS_ROOT)/maketree matrix + @ $(SICS_ROOT)/maketree dummy + @ $(SICS_ROOT)/maketree psi + @ $(SICS_ROOT)/maketree psi/hardsup + @ $(SICS_ROOT)/maketree psi/tecs + +cleanall: + $(MD:makfil=makefile_alpha) clean + $(MD:makfil=makefile_alpha_dummy) clean + +version_undefined: + @ echo "" + @ echo "Usage:" + @ echo "" + @ echo "Creating objects and targets mixed up with sources:" + @ echo "" + @ echo " make -f makefile_xxx [target]" + @ echo "" + @ echo ' where makefile_xxx is one of' + @ echo "" + @ ls -1 makefile_* | pr -t -o 4 + @ echo "" + @ echo "Creating objects and targets in separate subdirectories" + @ echo "" + @ echo " setenv SICS_VERSION version_xxx (assume we are using tcsh)" + @ echo " make tree (make the object directories)" + @ echo " make [target]" + @ echo "" + @ echo " where version_xxx is one of" + @ echo "" + @ ls -1 makefile_* | cut -b 10-99 | pr -t -o 4 + @ echo "" + @ echo " Tip: define the environment variables at login" + @ echo "" + diff --git a/make_gen b/make_gen index b200136f..bf0a6fdf 100644 --- a/make_gen +++ b/make_gen @@ -5,6 +5,8 @@ # Markus Zolliker March 2003 #--------------------------------------------------------------------------- +VPATH=$(SRC) + COBJ = Sclient.o network.o ifile.o intcli.o $(FORTIFYOBJ) SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \ servlog.o sicvar.o nserver.o SICSmain.o \ @@ -38,23 +40,17 @@ VELOOBJ = velo.o velosim.o .SUFFIXES: .SUFFIXES: .tcl .htm .c .o -# the following lines are not compatible with GNUmake using VPATH -# they are not needed, as they are defined by default -#.c.o: -# $(CC) $(CFLAGS) -c $*.c +all: SICServer -all: $(BINTARGET)/SICServer - full: matrix/libmatrix.a psi/hardsup/libhlib.a psi/tecs/libtecsl.a \ - psi/libpsi.a $(BINTARGET)/SICServer + psi/libpsi.a SICServer -$(BINTARGET)/SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ +SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ $(VELOOBJ) $(DIFIL) $(EXTRA) \ $(SUBLIBS) $(CC) -g -o SICServer \ $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ $(VELOOBJ) $(DIFOBJ) $(EXTRA) $(LIBS) - cp SICServer $(BINTARGET)/ matrix/libmatrix.a: cd matrix; make $(MFLAGS) libmatrix.a @@ -67,8 +63,9 @@ psi/tecs/libtecsl.a: psi/libpsi.a: cd psi; make $(MFLAGS) libpsi.a + clean: - rm -f *.o SICServer $(BINTARGET)/SICServer + rm -f *.o SICServer cd psi/hardsup; make $(MFLAGS) clean cd matrix; make $(MFLAGS) clean cd psi/tecs; make $(MFLAGS) clean diff --git a/make_gen_dummy b/make_gen_dummy index 4b091762..a0fd16b4 100644 --- a/make_gen_dummy +++ b/make_gen_dummy @@ -5,6 +5,8 @@ # Markus Zolliker March 2003 #--------------------------------------------------------------------------- +VPATH=$(SRC) + COBJ = Sclient.o network.o ifile.o intcli.o $(FORTIFYOBJ) SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \ servlog.o sicvar.o nserver.o SICSmain.o \ @@ -38,30 +40,25 @@ VELOOBJ = velo.o velosim.o .SUFFIXES: .SUFFIXES: .tcl .htm .c .o -# the following lines are not compatible with GNUmake using VPATH -# they are not needed, as they are defined by default -#.c.o: -# $(CC) $(CFLAGS) -c $*.c - -all: $(BINTARGET)/SICServer +all: SICServer -full: matrix/libmatrix.a dummy/libdummy.a $(BINTARGET)/SICServer +full: matrix/libmatrix.a dummy/libdummy.a SICServer -$(BINTARGET)/SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ +SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ $(VELOOBJ) $(DIFIL) $(EXTRA) \ $(SUBLIBS) $(CC) -g -o SICServer \ $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ $(VELOOBJ) $(DIFOBJ) $(EXTRA) $(LIBS) - cp SICServer $(BINTARGET)/ matrix/libmatrix.a: cd matrix; make $(MFLAGS) libmatrix.a dummy/libdummy.a: - cd dummy; make $(MFLAGS) + cd dummy; make $(MFLAGS) libdummy.a + clean: - rm -f *.o SICServer $(BINTARGET)/SICServer + rm -f *.o SICServer cd matrix; make $(MFLAGS) clean cd dummy; make $(MFLAGS) clean diff --git a/makefile b/makefile new file mode 100644 index 00000000..bdf941cb --- /dev/null +++ b/makefile @@ -0,0 +1,8 @@ +# this makefile delegates to a version specific makefile + +# where this subdirectory is (relative to root) +S_DOWN=. +# where root is +S_UP=. + +include make_forward diff --git a/makefile_alpha b/makefile_alpha index 183ff52c..55befc4a 100644 --- a/makefile_alpha +++ b/makefile_alpha @@ -9,24 +9,20 @@ #NI= -DHAVENI #NIOBJ= nigpib.o #NILIB=-lgpibenet -#========================================================================== -# comment or uncomment if a difrac version is required -# Do not forget to remove or add comments to ofac.c as well if changes -# were made here. - -#DIFOBJ=difrac.o -Ldifrac -ldif -#DIFIL= difrac.o #--------------------------------------------------------------------------- include alpha_def CC = cc -CFLAGS = -I$(HDFROOT)/include -I. $(DFORTIFY) -DHDF4 -DHDF5 -Ipsi/hardsup \ +CFLAGS = -I$(HDFROOT)/include $(DFORTIFY) -DHDF4 -DHDF5 \ + -I$(SRC). -I$(SRC)psi/hardsup \ -g -std1 -warnprotos BINTARGET = bin EXTRA= -LIBS = -L$(HDFROOT)/lib -Lpsi/hardsup -Lmatrix -lmatrix -Lpsi/tecs \ - -Lpsi -lpsi -lhlib -ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \ +SUBLIBS = psi/libpsi.a psi/hardsup/libhlib.a matrix/libmatrix.a \ + psi/tecs/libtecsl.a +LIBS = -L$(HDFROOT)/lib $(SUBLIBS) \ + -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \ $(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \ $(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc diff --git a/makefile_alpha_dummy b/makefile_alpha_dummy index 13996a4e..e1336fc4 100644 --- a/makefile_alpha_dummy +++ b/makefile_alpha_dummy @@ -5,35 +5,20 @@ # Mark Koennecke 1996-2001 # Markus Zolliker, March 2003 #========================================================================== -# the following lines only for fortified version -#DFORTIFY=-DFORTIFY -#FORTIFYOBJ=strdup.o fortify.o -#========================================================================== -# assign if the National Instrument GPIB driver is available -#NI= -DHAVENI -#NIOBJ= nigpib.o -#NILIB=-lgpibenet -#========================================================================== -# comment or uncomment if a difrac version is required -# Do not forget to remove or add comments to ofac.c as well if changes -# were made here. - -#DIFOBJ=difrac.o -Ldifrac -ldif -#DIFIL= difrac.o -#--------------------------------------------------------------------------- -#----------------select proper Makefile -MFLAGS= -f makefile_alpha_dummy +DUMMY=_dummy +include alpha_def HDFROOT=/data/lnslib CC = cc -CFLAGS = -I$(HDFROOT)/include -I. $(DFORTIFY) -DHDF4 -DHDF5 \ +CFLAGS = -I$(HDFROOT)/include -I$(SRC). $(DFORTIFY) -DHDF4 -DHDF5 \ -g -std1 -warnprotos BINTARGET = bin EXTRA= -LIBS = -L$(HDFROOT)/lib -Lmatrix -lmatrix \ - -Ldummy -ldummy -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \ +SUBLIBS = matrix/libmatrix.a dummy/libdummy.a +LIBS = -L$(HDFROOT)/lib $(SUBLIBS) \ + -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \ $(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \ $(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc diff --git a/makefile_linux b/makefile_linux index 64a2c25c..623f274e 100644 --- a/makefile_linux +++ b/makefile_linux @@ -9,11 +9,13 @@ #NI= -DHAVENI #NIOBJ= nigpib.o #NILIB=-lgpibenet +#--------------------------------------------------------------------------- -include linux_def +include $(SRC)linux_def CC = gcc -CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -Ipsi/hardsup -I. \ +CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) \ + -I$(SRC)psi/hardsup -I$(SRC). \ -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) BINTARGET = bin diff --git a/makefile_linux_dummy b/makefile_linux_dummy index 954a5cc1..6c684e16 100644 --- a/makefile_linux_dummy +++ b/makefile_linux_dummy @@ -1,26 +1,22 @@ #--------------------------------------------------------------------------- # Makefile for SICS -# machine-dependent part for Tru64 Unix +# machine-dependent part for Red Hat Linux # # Mark Koennecke 1996-2001 # Markus Zolliker, March 2003 #========================================================================== -# the following lines only for fortified version -#DFORTIFY=-DFORTIFY -#FORTIFYOBJ=strdup.o fortify.o -#========================================================================== # assign if the National Instrument GPIB driver is available #NI= -DHAVENI #NIOBJ= nigpib.o #NILIB=-lgpibenet -#----------------select proper Makefile -MFLAGS= -f makefile_linux_dummy + +DUMMY=_dummy +include $(SRC)linux_def CC = gcc -CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I. \ +CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I$(SRC). \ -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) -BINTARGET = bin HDFROOT=/afs/psi.ch/project/sinq/linux EXTRA=nintf.o SUBLIBS = dummy/libdummy.a matrix/libmatrix.a @@ -30,7 +26,7 @@ LIBS = -L$(HDFROOT)/lib $(SUBLIBS) \ $(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc -include make_gen_dummy +include $(SRC)make_gen_dummy diff --git a/maketree b/maketree new file mode 100755 index 00000000..7965767f --- /dev/null +++ b/maketree @@ -0,0 +1,32 @@ +#!/bin/tcsh +# create the version specific object tree +# +# M.Zolliker 08.2003 +# +if ("$SICS_VERSION" == "") then + + echo SICS_VERSION undefined + +else + + set SICS_ROOT=${0:h} + +# determine object directory + set o="$SICS_ROOT/obj/$SICS_VERSION/$1" + +# determine makefile + set m="$SICS_ROOT/$1/makefile_$SICS_VERSION" + + if (-e $m) then + if (! -e $o) then + echo create directory $o + mkdir -p $o + else + echo $o exists + endif + rm -f $o/src + echo ln -s $SICS_ROOT/$1 $o/src + ln -s $SICS_ROOT/$1 $o/src + endif +endif + diff --git a/matrix/make_gen b/matrix/make_gen index 992e1d54..d7449dcf 100644 --- a/matrix/make_gen +++ b/matrix/make_gen @@ -4,6 +4,8 @@ # Mark Koennecke, November 1996 #-------------------------------------------------------------------------- +VPATH=$(SRC) + OBJ= matadd.o matcreat.o matdet.o matdump.o matdurbn.o materr.o \ matinv.o matmul.o matsolve.o matsub.o matsubx.o mattoepz.o \ mattran.o diff --git a/matrix/makefile b/matrix/makefile new file mode 100644 index 00000000..44bdaed0 --- /dev/null +++ b/matrix/makefile @@ -0,0 +1,8 @@ +# this makefile delegates to a version specific makefile + +# where this subdirectory is (relative to the sics root) +S_DOWN=matrix +# where root is (from here) +S_UP=.. + +include ../make_forward diff --git a/matrix/makefile_alpha_dummy b/matrix/makefile_alpha_dummy new file mode 100644 index 00000000..a0c7f3b2 --- /dev/null +++ b/matrix/makefile_alpha_dummy @@ -0,0 +1,2 @@ +DUMMY=_dummy +include makefile_alpha diff --git a/matrix/makefile_linux b/matrix/makefile_linux index 2be8fbda..a349e678 100644 --- a/matrix/makefile_linux +++ b/matrix/makefile_linux @@ -6,7 +6,7 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- -include ../linux_def +include ../$(SRC)linux_def CC = gcc CFLAGS = -g $(DFORTIFY) diff --git a/matrix/makefile_linux_dummy b/matrix/makefile_linux_dummy index 8a3b93cf..c65862fb 100644 --- a/matrix/makefile_linux_dummy +++ b/matrix/makefile_linux_dummy @@ -1,15 +1,2 @@ -#--------------------------------------------------------------------------- -# Makefile for the Matrix library -# machine-dependent part for Redhat Linux with AFS at PSI -# -# Mark Koennecke, November 1996 -# Markus Zolliker, March 2003 -#-------------------------------------------------------------------------- -# the following line only for fortified version -DFORTIFY=-DFORTIFY -#========================================================================== - -CC = gcc -CFLAGS = -g $(DFORTIFY) - -include $(SRC)make_gen +DUMMY=_dummy +include $(SRC)makefile_linux diff --git a/o2t.h b/o2t.h index 422ed590..9d695939 100644 --- a/o2t.h +++ b/o2t.h @@ -19,4 +19,3 @@ int argc, char *argv[]); #endif - \ No newline at end of file