From edaf2a01f4021aed84f3925bca2a8d9c8f889cb5 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 5 Sep 1991 16:35:56 +0000 Subject: [PATCH] new installation mechanism --- mach/i386/ce/.distr | 2 +- mach/i386/ce/proto.make | 32 +++++++++++++++++++++++ mach/m68020/ce/.distr | 2 +- mach/m68020/ce/notes | 8 ++++++ mach/m68020/ce/proto.make | 32 +++++++++++++++++++++++ util/ceg/util/.distr | 3 +-- util/ceg/util/install_ceg | 28 ++++++++++++++------ util/ceg/util/make_asobj | 38 +++++++++++++++++---------- util/ceg/util/make_back | 22 ++++++++++------ util/ceg/util/make_ce | 35 +++++++++++++------------ util/ceg/util/make_ceg | 54 +++++++++++++++++++++++++++++++++++++++ util/ceg/util/make_own | 33 +++++++++++++++--------- util/ceg/util/proto.make | 30 ++++++++++++++++++++++ util/ceg/util/update_ceg | 33 +++++++++++++++++------- 14 files changed, 281 insertions(+), 71 deletions(-) create mode 100644 mach/i386/ce/proto.make create mode 100644 mach/m68020/ce/notes create mode 100644 mach/m68020/ce/proto.make create mode 100644 util/ceg/util/make_ceg create mode 100644 util/ceg/util/proto.make diff --git a/mach/i386/ce/.distr b/mach/i386/ce/.distr index 01acdb26e..de050f836 100644 --- a/mach/i386/ce/.distr +++ b/mach/i386/ce/.distr @@ -1,5 +1,5 @@ EM_table -Makefile +proto.make as.c as.h as_table diff --git a/mach/i386/ce/proto.make b/mach/i386/ce/proto.make new file mode 100644 index 000000000..ad8361b2e --- /dev/null +++ b/mach/i386/ce/proto.make @@ -0,0 +1,32 @@ +# $Header$ + +#PARAMS do not remove this line! + +SRC_DIR = $(SRC_HOME)/mach/i386/ce + +CEG = $(TARGET_HOME)/lib.bin/ceg/util +OBJ = obj +MACH = i386 + +all: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) + +install: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) install + +cmp: + -make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) cmp + +pr: + @pr $(SRC_DIR)/proto.make $(SRC_DIR)/EM_table $(SRC_DIR)/mach.h $(SRC_DIR)/mach.c $(SRC_DIR)/as_table $(SRC_DIR)/as.h $(SRC_DIR)/as.c + +opr: + make pr | opr + +# total cleanup +clean: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean + +# only remove ce, ceg, and back directories +dclean: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean diff --git a/mach/m68020/ce/.distr b/mach/m68020/ce/.distr index 5b1b1ea9b..f2261a886 100644 --- a/mach/m68020/ce/.distr +++ b/mach/m68020/ce/.distr @@ -1,4 +1,4 @@ -Makefile +proto.make as_table mach.c mach.h diff --git a/mach/m68020/ce/notes b/mach/m68020/ce/notes new file mode 100644 index 000000000..a2b08420a --- /dev/null +++ b/mach/m68020/ce/notes @@ -0,0 +1,8 @@ +Helaas het framework kan niet tegen mnemonics met '.' erin, bijv. + add.l + move.w + +Oplossing: + +Alle punten door underscores vervangen in 'as_table' en process_menemonic() +aangepast zodat ook de punten uit de 'EM_table' omgewzet worden in underscores. diff --git a/mach/m68020/ce/proto.make b/mach/m68020/ce/proto.make new file mode 100644 index 000000000..25a33a6c1 --- /dev/null +++ b/mach/m68020/ce/proto.make @@ -0,0 +1,32 @@ +# $Header$ + +#PARAMS do not remove this line! + +MACH = m68020 +OBJ = obj +SRC_DIR = $(SRC_HOME)/mach/$(MACH)/ce + +CEG = $(TARGET_HOME)/lib.bin/ceg/util + +all: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) + +install: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) install + +cmp: + -make -f $(CEG)/make_asobj "OBJ="$(OBJ) "MACH="$(MACH) cmp + +pr: + @pr $(SRC_DIR)/proto.make $(SRC_DIR)/EM_table $(SRC_DIR)/mach.h $(SRC_DIR)/mach.c $(SRC_DIR)/as_table $(SRC_DIR)/as.h $(SRC_DIR)/as.c + +opr: + make pr | opr + +# total cleanup +clean: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) clean + +# only remove ce, ceg, and back directories +dclean: + make -f $(CEG)/make_asobj "OBJ="$(OBJ) dclean diff --git a/util/ceg/util/.distr b/util/ceg/util/.distr index 6db0a9477..738689205 100644 --- a/util/ceg/util/.distr +++ b/util/ceg/util/.distr @@ -3,7 +3,6 @@ install_ceg make_asobj make_back make_ce -make_ceg_as -make_ceg_obj +make_ceg make_own update_ceg diff --git a/util/ceg/util/install_ceg b/util/ceg/util/install_ceg index 7289c0b87..1c74cfa6f 100644 --- a/util/ceg/util/install_ceg +++ b/util/ceg/util/install_ceg @@ -1,18 +1,30 @@ -EMHOME=../../.. -CEG=../../../lib/ceg/util +CEG=$TARGET_HOME/lib.bin/ceg/util case $# in - 1) case $1 in + 2) case $1 in -as) MAKE=$CEG/make_asobj;OBJ=as;; -obj) MAKE=$CEG/make_asobj;OBJ=obj;; *) echo wrong option $1, use -as or -obj; exit 1;; - esac;; - - 0) MAKE=$CEG/make_own;OBJ=obj ;; + esac + SRC_DIR=$2 + ;; - *) echo wrong number of arguments; + 1) MAKE=$CEG/make_own;OBJ=obj;SRC_DIR=$1 ;; + + + *) echo Usage: $0 [-as|-obj] exit 1;; esac -make -f $MAKE OBJ=$OBJ install + +case X$MACH in +X) MACH=`expr $SRC_DIR : '.*/mach/\(.*\)/ce*` + ;; +esac +case X$MACH in + echo environment definition for MACH required + exit 1 + ;; +esac +make -f $MAKE OBJ=$OBJ MACH=$MACH SRC_DIR=$SRC_DIR install diff --git a/util/ceg/util/make_asobj b/util/ceg/util/make_asobj index 9413d4fb3..8254a949b 100644 --- a/util/ceg/util/make_asobj +++ b/util/ceg/util/make_asobj @@ -1,31 +1,41 @@ -EM = ../../.. -CEG = $(EM)/lib/ceg +# $Header$ + +#PARAMS do not remove this line! + +#requires definition of MACH; possible redefinition of SRC_DIR + +EM = $(TARGET_HOME) +CEG = $(EM)/lib.bin/ceg CE_MAKE = $(CEG)/util/make_ce BACK_MAKE = $(CEG)/util/make_back -CEG_MAKE = $(CEG)/util/make_ceg_$(OBJ) +CEG_MAKE = $(CEG)/util/make_ceg + +SRC_DIR = $(SRC_HOME)/mach/$(MACH)/ce -all: back.a ceg/ceg ce.a +all: back.$(LIBSUF) ceg/ceg ce.$(LIBSUF) install: all - ../../install ce.a - ../../install back.a + cp ce.$(LIBSUF) $(EM)/lib.bin/$(MACH)/ce.$(LIBSUF) + $(RANLIB) $(EM)/lib.bin/$(MACH)/ce.$(LIBSUF) + cp back.$(LIBSUF) $(EM)/lib.bin/$(MACH)/back.$(LIBSUF) + $(RANLIB) $(EM)/lib.bin/$(MACH)/back.$(LIBSUF) cmp: all - -../../compare ce.a - -../../compare back.a + -cmp ce.$(LIBSUF) $(EM)/lib.bin/$(MACH)/ce.$(LIBSUF) + -cmp back.$(LIBSUF) $(EM)/lib.bin/$(MACH)/back.$(LIBSUF) clean: - rm -rf ce back ceg ce.a back.a Out + rm -rf ce back ceg ce.$(LIBSUF) back.$(LIBSUF) Out dclean: rm -rf ce back ceg Out -ce.a: - make -f $(CE_MAKE) +ce.$(LIBSUF): + make -f $(CE_MAKE) "SRC_DIR="$(SRC_DIR) -back.a: - make -f $(BACK_MAKE) "OBJ="$(OBJ) +back.$(LIBSUF): + make -f $(BACK_MAKE) "OBJ="$(OBJ) "SRC_DIR="$(SRC_DIR) ceg/ceg: - make -f $(CEG_MAKE) + make -f $(CEG_MAKE) "OBJ="$(OBJ) "SRC_DIR="$(SRC_DIR) diff --git a/util/ceg/util/make_back b/util/ceg/util/make_back index c4382afa1..2201de07b 100644 --- a/util/ceg/util/make_back +++ b/util/ceg/util/make_back @@ -1,13 +1,19 @@ -EM = ../../../.. -CEG = $(EM)/lib/ceg +# $Header$ + +#PARAMS do not remove this line! + +# requires definitions for OBJ and SRC_DIR; not to be called directly + +CEG = $(TARGET_HOME)/lib.bin/ceg BACK = $(CEG)/ce_back/$(OBJ)_back -AR = ar +all: back.$(LIBSUF) -all: back.a - -back.a: mach.h +back.$(LIBSUF): mach.h -mkdir back cd back;cp $(BACK)/*h . ; cp $(BACK)/Makefile . ; make ; cd .. - $(AR) r back.a back/*o - -sh -c 'ranlib back.a' + $(AR) r back.$(LIBSUF) back/*.$(SUF) + $(RANLIB) back.$(LIBSUF) + +mach.h: $(SRC_DIR)/mach.h + cp $(SRC_DIR)/mach.h . diff --git a/util/ceg/util/make_ce b/util/ceg/util/make_ce index d88d89b3d..12ed60a16 100644 --- a/util/ceg/util/make_ce +++ b/util/ceg/util/make_ce @@ -1,30 +1,33 @@ -EM = ../../../.. -CEG = $(EM)/lib/ceg +# $Header$ + +#PARAMS do not remove this line! + +#requires a definition for SRC_DIR; not to be called directly. + +EM = $(TARGET_HOME) +CEG = $(EM)/lib.bin/ceg AS = $(CEG)/as_parser DEF = $(CEG)/defaults -AR = ar -CC = cc +IFILES = -I. -I$(SRC_DIR) -I$(AS) -I$(EM)/h -I$(EM)/modules/h -I../back -I$(SRC_HOME)/mach -IFILES = -I. -I.. -I$(AS) -I$(EM)/h -I$(EM)/modules/h -I../back -I$(EM)/mach +CFLAGS = $(COPTIONS) $(IFILES) -CFLAGS = -O $(IFILES) - -.c.o: +.c.$(SUF): cd ce ; $(CC) -c $(CFLAGS) ../$*.c ; cd .. -all: ce.a +all: ce.$(LIBSUF) -ce.a: ce/dummy - $(AR) r ce.a ce/*.o - -sh -c 'ranlib ce.a' +ce.$(LIBSUF): ce/dummy + $(AR) r ce.$(LIBSUF) ce/*.$(SUF) + $(RANLIB) ce.$(LIBSUF) -ce/dummy: ce/dummy1 mach.h back.a +ce/dummy: ce/dummy1 back.$(LIBSUF) cd ce ; $(CC) -c $(CFLAGS) *.c ; touch dummy ; cd .. -ce/dummy1: ceg/ceg EM_table +ce/dummy1: ceg/ceg $(SRC_DIR)/EM_table $(SRC_DIR)/mach.c -mkdir ce - -ln mach.c ce/mach.c + -cp $(SRC_DIR)/mach.c ce/mach.c cd ce ; ../ceg/ceg -l < $(DEF)/not_impl/not_impl_table ; cp $(DEF)/*.c . ; cp $(DEF)/*/*.c . ; cd .. - cd ce ; $(EM)/lib/cpp -P ../EM_table | ../ceg/ceg -l ; touch dummy1 ; cd .. + cd ce ; $(EM)/lib.bin/cpp -P $(SRC_DIR)/EM_table | ../ceg/ceg -l ; touch dummy1 ; cd .. diff --git a/util/ceg/util/make_ceg b/util/ceg/util/make_ceg new file mode 100644 index 000000000..adfe84a2b --- /dev/null +++ b/util/ceg/util/make_ceg @@ -0,0 +1,54 @@ +# $Header$ + +#PARAMS do not remove this line! + +#requires definitions for OBJ and SRC_DIR; not to be called directly + +CEG = $(TARGET_HOME)/lib.bin/ceg + +Em = $(CEG)/EM_parser/$(OBJ)_EM_pars +ASMAIN = $(CEG)/assemble/$(OBJ)_assemble +AS = $(CEG)/as_parser +EVAL = $(CEG)/as_parser/eval +DEF = $(CEG)/defaults + +IFILES = -I. -I$(SRC_DIR) -I$(AS) -I$(Em) -I$(TARGET_HOME)/h -I$(TARGET_HOME)/modules/h -I../back + +CFLAGS = $(COPTIONS) $(IFILES) +LDFLAGS = $(LDOPTIONS) + +CEG_LIBS = $(TARGET_HOME)/modules/lib/liballoc.$(LIBSUF)\ + $(TARGET_HOME)/modules/lib/libprint.$(LIBSUF)\ + $(TARGET_HOME)/modules/lib/libstring.$(LIBSUF)\ + $(TARGET_HOME)/modules/lib/libsystem.$(LIBSUF) + +all: ceg/ceg + +obj_list: ceg/as_lib.$(LIBSUF) ceg/as_instr.$(SUF) ceg/eval_as.$(SUF) + echo 'ceg/as_lib.$(LIBSUF) ceg/as_instr.$(SUF) ceg/eval_as.$(SUF)' > list + +as_list: ceg/as_lib.$(LIBSUF) + echo 'ceg/as_lib.$(LIBSUF)' > list + +list: $(OBJ)_list + +ceg/ceg: list + $(CC) $(LDFLAGS) -o ceg/ceg $(Em)/*.$(SUF) `cat list` $(CEG_LIBS) + +ceg/as_lib.$(LIBSUF): + -mkdir ceg + cd ceg ; cp $(CEG)/util/make_ceg_$(OBJ) Makefile ; cd .. + cd ceg ; cp $(ASMAIN)/* . ; $(CC) -c $(CFLAGS) *.c; $(AR) r as_lib.$(LIBSUF) *.$(SUF) ; cd .. + $(RANLIB) ceg/as_lib.$(LIBSUF) + +ceg/eval_as.$(SUF) : ceg/eval_as.c $(SRC_DIR)/as.h # $(AS)/as_parser.h $(Em)/arg_type.h + cd ceg ; $(CC) -c $(CFLAGS) eval_as.c ; cd .. + +ceg/eval_as.c : $(SRC_DIR)/as.c # $(EVAL)/eval + cd ceg ; $(EVAL)/eval < $(SRC_DIR)/as.c > eval_as.c ; cd .. + +ceg/as_instr.$(SUF) : $(SRC_DIR)/as.h ceg/as_lib.$(LIBSUF) ceg/as_instr.c + cd ceg ; $(CC) -c $(CFLAGS) as_instr.c ; cd .. + +ceg/as_instr.c : $(SRC_DIR)/as_table # $(AS)/as_parser + cd ceg ; $(TARGET_HOME)/lib.bin/cpp -P $(SRC_DIR)/as_table | $(AS)/as_parser > as_instr.c ; cd .. diff --git a/util/ceg/util/make_own b/util/ceg/util/make_own index 730d89544..89a15f0f2 100644 --- a/util/ceg/util/make_own +++ b/util/ceg/util/make_own @@ -1,28 +1,37 @@ -EM = ../../.. -CEG = $(EM)/lib/ceg +# $Header$ + +#PARAMS do not remove this line! + +#requires definition of MACH; possible redefinition of SRC_DIR + +EM = $(TARGET_HOME) +CEG = $(EM)/lib.bin/ceg CE_MAKE = $(CEG)/util/make_ce BACK_MAKE = $(CEG)/util/make_back -CEG_MAKE = $(CEG)/util/make_ceg_obj +CEG_MAKE = $(CEG)/util/make_ceg +SRC_DIR = $(SRC_HOME)/mach/$(MACH)/ce -all: ceg/ceg ce.a +all: ceg/ceg ce.$(LIBSUF) install: all - ../../install ce.a - ../../install back.a + cp ce.$(LIBSUF) $(EM)/lib.bin/$(MACH)/ce.$(LIBSUF) + $(RANLIB) $(EM)/lib.bin/$(MACH)/ce.$(LIBSUF) + cp back.$(LIBSUF) $(EM)/lib.bin/$(MACH)/back.$(LIBSUF) + $(RANLIB) $(EM)/lib.bin/$(MACH)/back.$(LIBSUF) cmp: all - -../../compare ce.a - -../../compare back.a + -cmp ce.$(LIBSUF) $(EM)/lib.bin/$(MACH)/ce.$(LIBSUF) + -cmp back.$(LIBSUF) $(EM)/lib.bin/$(MACH)/back.$(LIBSUF) clean: - rm -rf ce ceg ce.a Out + rm -rf ce ceg ce.$(LIBSUF) Out dclean: rm -rf ce ceg Out -ce.a: - make -f $(CE_MAKE) +ce.$(LIBSUF): + make -f $(CE_MAKE) "SRC_DIR="$(SRC_DIR) ceg/ceg: - make -f $(CEG_MAKE) + make -f $(CEG_MAKE) "OBJ="obj "SRC_DIR="$(SRC_DIR) diff --git a/util/ceg/util/proto.make b/util/ceg/util/proto.make new file mode 100644 index 000000000..1e44caff8 --- /dev/null +++ b/util/ceg/util/proto.make @@ -0,0 +1,30 @@ +# $Header$ + +#PARAMS do not remove this line! + +SRC_DIR = $(SRC_HOME)/util/ceg/util +CEGLIB = $(TARGET_HOME)/lib.bin/ceg +UTIL = $(CEGLIB)/util +UtilList = make_asobj make_own make_back make_ce make_ceg + +all: + +install: + -mkdir $(CEGLIB) + -mkdir $(UTIL) + for i in $(UtilList) ; do cp $$i $(UTIL)/$$i ; done + { echo TARGET_HOME=$(TARGET_HOME); cat $(SRC_DIR)/install_ceg } > $(TARGET_HOME)/bin/install_ceg + chmod +x $(TARGET_HOME)/bin/install_ceg + { echo TARGET_HOME=$(TARGET_HOME); echo SUF=$(SUF); echo LIBSUF=$(LIBSUF); cat $(SRC_DIR)/update_ceg } > $(TARGET_HOME)/bin/update_ceg + chmod +x $(TARGET_HOME)/bin/update_ceg + +cmp: + -for i in $(UtilList) ; do cmp $$i $(UTIL)/$$i ; done + +clean: + +pr: + @for i in $(UtilList) ; do pr $(SRC_DIR)/$$i ; done + +opr: + make pr | opr diff --git a/util/ceg/util/update_ceg b/util/ceg/util/update_ceg index 5c153fd7f..4cc01e916 100755 --- a/util/ceg/util/update_ceg +++ b/util/ceg/util/update_ceg @@ -1,28 +1,43 @@ -MAKE=../../../lib/ceg/util/make_ce +CEG=$TARGET_HOME/lib.bin/ceg +MAKE=$CEG/util/make_ce -make -f ceg/Makefile +case $# in + 2) case $1 in + -as) OBJ=as;; + -obj) OBJ=obj;; + *) echo wrong option $1, use -as or -obj; + exit 1;; + esac + SRC_DIR=$2 + ;; + 1) SRC_DIR=$1;OBJ=obj ;; + *) echo Usage: $0 [-as|-obj] + ;; +esac + +make -f ceg/Makefile SRC_DIR=$SRC_DIR OBJ=$OBJ for i do case $i in - ALL) make -f $MAKE ce.a + ALL) make -f $MAKE SRC_DIR=$SRC_DIR ce.$LIBSUF exit 0 ;; - *.o) make -f $MAKE ce/$i + *.$SUF) make -f $MAKE SRC_DIR=$SRC_DIR ce/$i ;; - *..) ( cd ce; ../../../../lib/cpp -P ../EM_table | ../ceg/ceg -c $i) + *..) ( cd ce; $TARGET_HOME/lib.bin/cpp -P $SRC_DIR/EM_table | ../ceg/ceg -c $i) F=`basename $i ..` U="_dnam" V="_dlb" - make -f $MAKE ce/$F.o ce/$F$U.o ce/"$F$V.o" + make -f $MAKE SRC_DIR=$SRC_DIR ce/$F.$SUF ce/$F$U.$SUF ce/$F$V.$SUF ;; - *) ( cd ce; ../../../../lib/cpp -P ../EM_table | ../ceg/ceg -c $i) - make -f $MAKE ce/$i.o + *) ( cd ce; $TARGET_HOME/lib.bin/cpp -P $SRC_DIR/EM_table | ../ceg/ceg -c $i) + make -f $MAKE SRC_DIR=$SRC_DIR ce/$i.$SUF ;; esac done touch ce/dummy -make -f $MAKE ce.a +make -f $MAKE SRC_DIR=$SRC_DIR ce.$LIBSUF