diff --git a/util/ceg/util/.distr b/util/ceg/util/.distr index f43c5598c..6db0a9477 100644 --- a/util/ceg/util/.distr +++ b/util/ceg/util/.distr @@ -1,7 +1,9 @@ -create_ofiles +Makefile install_ceg -make_as -make_obj +make_asobj +make_back +make_ce +make_ceg_as +make_ceg_obj make_own update_ceg -Makefile diff --git a/util/ceg/util/Makefile b/util/ceg/util/Makefile index 7c7c906ba..e473f63de 100644 --- a/util/ceg/util/Makefile +++ b/util/ceg/util/Makefile @@ -1,7 +1,7 @@ EM = ../../.. CEGLIB = $(EM)/lib/ceg UTIL = $(CEGLIB)/util -UtilList = make_as make_obj make_own +UtilList = make_asobj make_own make_back make_ce make_ceg_as make_ceg_obj all: diff --git a/util/ceg/util/install_ceg b/util/ceg/util/install_ceg index ae255bd72..7289c0b87 100644 --- a/util/ceg/util/install_ceg +++ b/util/ceg/util/install_ceg @@ -1,16 +1,18 @@ +EMHOME=../../.. CEG=../../../lib/ceg/util case $# in 1) case $1 in - -as) cp $CEG/make_as ce_makefile;; - -obj) cp $CEG/make_obj ce_makefile;; + -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) cp $CEG/make_own ce_makefile;; + 0) MAKE=$CEG/make_own;OBJ=obj ;; + *) echo wrong number of arguments; exit 1;; esac -make -f ce_makefile install +make -f $MAKE OBJ=$OBJ install diff --git a/util/ceg/util/make_asobj b/util/ceg/util/make_asobj new file mode 100644 index 000000000..9413d4fb3 --- /dev/null +++ b/util/ceg/util/make_asobj @@ -0,0 +1,31 @@ +EM = ../../.. +CEG = $(EM)/lib/ceg +CE_MAKE = $(CEG)/util/make_ce +BACK_MAKE = $(CEG)/util/make_back +CEG_MAKE = $(CEG)/util/make_ceg_$(OBJ) + + +all: back.a ceg/ceg ce.a + +install: all + ../../install ce.a + ../../install back.a + +cmp: all + -../../compare ce.a + -../../compare back.a + +clean: + rm -rf ce back ceg ce.a back.a Out + +dclean: + rm -rf ce back ceg Out + +ce.a: + make -f $(CE_MAKE) + +back.a: + make -f $(BACK_MAKE) "OBJ="$(OBJ) + +ceg/ceg: + make -f $(CEG_MAKE) diff --git a/util/ceg/util/make_back b/util/ceg/util/make_back new file mode 100644 index 000000000..c4382afa1 --- /dev/null +++ b/util/ceg/util/make_back @@ -0,0 +1,13 @@ +EM = ../../../.. +CEG = $(EM)/lib/ceg +BACK = $(CEG)/ce_back/$(OBJ)_back + +AR = ar + +all: back.a + +back.a: 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' diff --git a/util/ceg/util/make_ce b/util/ceg/util/make_ce new file mode 100644 index 000000000..d894edc1f --- /dev/null +++ b/util/ceg/util/make_ce @@ -0,0 +1,30 @@ +EM = ../../../.. +CEG = $(EM)/lib/ceg + +AS = $(CEG)/as_parser +DEF = $(CEG)/defaults + +AR = ar +CC = cc + +IFILES = -I. -I.. -I$(AS) -I$(EM)/h -I$(EM)/modules/h -I../back + +CFLAGS = -O $(IFILES) + +.c.o: mach.h back.a + cd ce ; $(CC) -c $(CFLAGS) ../$*.c ; cd .. + +all: ce.a + +ce.a: ce/dummy + $(AR) r ce.a ce/*.o + -sh -c 'ranlib ce.a' + +ce/dummy: ce/dummy1 mach.h back.a + cd ce ; $(CC) -c $(CFLAGS) *.c ; touch dummy ; cd .. + +ce/dummy1: ceg/ceg EM_table + -mkdir ce + -ln 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 .. diff --git a/util/ceg/util/make_ceg_as b/util/ceg/util/make_ceg_as new file mode 100644 index 000000000..54772348b --- /dev/null +++ b/util/ceg/util/make_ceg_as @@ -0,0 +1,31 @@ +EM = ../../../.. +CEG = $(EM)/lib/ceg + +Em = $(CEG)/EM_parser/as_EM_pars +ASMAIN = $(CEG)/assemble/as_assemble +AS = $(CEG)/as_parser +DEF = $(CEG)/defaults + +AR = ar +CC = cc +LEXLIB = -ll + +IFILES = -I. -I.. -I$(AS) -I$(Em) -I$(EM)/h -I$(EM)/modules/h -I../back + +CFLAGS = -O $(IFILES) + +CEG_LIBS = $(EM)/modules/lib/liballoc.a\ + $(EM)/modules/lib/libprint.a\ + $(EM)/modules/lib/libstring.a\ + $(EM)/modules/lib/libsystem.a + +all: ceg/ceg + +ceg/ceg: ceg/as_lib.a + cd ceg ; $(CC) -o ceg $(Em)/*.o as_lib.a $(CEG_LIBS) $(LEXLIB) ; cd .. + +ceg/as_lib.a: + -mkdir ceg + ce ceg ; cp $(CEG)/util/make_ceg_as Makefile ; cd .. + cd ceg ; cp $(ASMAIN)/* . ; $(CC) -c $(CFLAGS) *.c; $(AR) r as_lib.a *.o ; cd .. + -sh -c 'ranlib ceg/as_lib.a' diff --git a/util/ceg/util/make_ceg_obj b/util/ceg/util/make_ceg_obj new file mode 100644 index 000000000..df1ac3945 --- /dev/null +++ b/util/ceg/util/make_ceg_obj @@ -0,0 +1,44 @@ +EM = ../../../.. +CEG = $(EM)/lib/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 + +AR = ar +CC = cc +LEXLIB = -ll + +IFILES = -I. -I.. -I$(AS) -I$(Em) -I$(EM)/h -I$(EM)/modules/h -I../back + +CFLAGS = -O $(IFILES) + +CEG_LIBS = $(EM)/modules/lib/liballoc.a\ + $(EM)/modules/lib/libprint.a\ + $(EM)/modules/lib/libstring.a\ + $(EM)/modules/lib/libsystem.a + +all: ceg/ceg + +ceg/ceg : ceg/as_lib.a ceg/as_instr.o ceg/eval_as.o + cd ceg ; $(CC) -o ceg $(Em)/*.o as_instr.o eval_as.o as_lib.a $(CEG_LIBS) $(LEXLIB) ; cd .. + +ceg/as_lib.a: + -mkdir ceg + cd ceg ; cp $(CEG)/util/make_ceg_obj Makefile ; cd .. + cd ceg ; cp $(ASMAIN)/* . ; $(CC) -c $(CFLAGS) *.c; $(AR) r as_lib.a *.o ; cd .. + -sh -c 'ranlib ceg/as_lib.a' + +ceg/eval_as.o : ceg/eval_as.c as.h # $(AS)/as_parser.h $(Em)/arg_type.h + cd ceg ; $(CC) -c $(CFLAGS) eval_as.c ; cd .. + +ceg/eval_as.c : as.c # $(EVAL)/eval + cd ceg ; $(EVAL)/eval < ../as.c > eval_as.c ; cd .. + +ceg/as_instr.o : as.h ceg/as_lib.a ceg/as_instr.c + cd ceg ; $(CC) -c $(CFLAGS) as_instr.c ; cd .. + +ceg/as_instr.c : as_table # $(AS)/as_parser + cd ceg ; $(EM)/lib/cpp -P ../as_table | $(AS)/as_parser > as_instr.c ; cd .. diff --git a/util/ceg/util/make_own b/util/ceg/util/make_own index 62824f2ab..730d89544 100644 --- a/util/ceg/util/make_own +++ b/util/ceg/util/make_own @@ -1,29 +1,11 @@ -EM = ../../../.. -CEG = $(EM)/lib/ceg +EM = ../../.. +CEG = $(EM)/lib/ceg +CE_MAKE = $(CEG)/util/make_ce +BACK_MAKE = $(CEG)/util/make_back +CEG_MAKE = $(CEG)/util/make_ceg_obj -Em = $(CEG)/EM_parser/obj_EM_pars -ASMAIN = $(CEG)/assemble/obj_assemble -AS = $(CEG)/as_parser -EVAL = $(CEG)/as_parser/eval -DEF = $(CEG)/defaults -CC = cc -AR = ar -LEXLIB = -ll - -IFILES = -I. -I.. -I$(AS) -I$(Em) -I$(EM)/h -I$(EM)/modules/h -I../back - -CFLAGS = -O $(IFILES) - -CEG_LIBS = $(EM)/modules/lib/liballoc.a\ - $(EM)/modules/lib/libprint.a\ - $(EM)/modules/lib/libstring.a\ - $(EM)/modules/lib/libsystem.a - -.c.o: mach.h back.a - ce ce ; $(CC) -c $(CFLAGS) ../$*.c ; cd .. - -all: back.a ce.a +all: ceg/ceg ce.a install: all ../../install ce.a @@ -34,44 +16,13 @@ cmp: all -../../compare back.a clean: - rm -rf ce ceg ce.a back.a Out + rm -rf ce ceg ce.a Out dclean: rm -rf ce ceg Out -ce.a : ce/dummy - $(AR) r ce.a ce/*.o - -sh -c 'ranlib ce.a' +ce.a: + make -f $(CE_MAKE) -ce/dummy : ce/dummy1 mach.h back.a - cd ce;$(CC) -c $(CFLAGS) *.c; touch dummy ; cd .. - -ce/dummy1: ceg/ceg EM_table mach.h back.a - -mkdir ce - -ln 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 ; cd .. - touch ce/dummy1 - -ceg/as_lib.a: - -mkdir ceg - cd ceg; cp $(ASMAIN)/* . ; touch dummy ; $(CC) -c $(IFILES) *.c; $(AR) r as_lib.a *.o ; cd .. - -sh -c 'ranlib ceg/as_lib.a' - -ceg/ceg : ceg/as_lib.a ceg/assemble.o ceg/as_instr.o ceg/eval_as.o - cd ceg ; $(CC) -o ceg $(Em)/*.o assemble.o as_instr.o eval_as.o as_lib.a $(CEG_LIBS) $(LEXLIB) ; cd .. - -ceg/assemble.o : as.h ceg/assemble.c ceg/dummy - cd ceg;$(CC) -c $(IFILES) assemble.c ; cd .. - -ceg/as_instr.o : as.h ceg/*h ceg/as_instr.c - cd ceg;$(CC) -c $(IFILES) as_instr.c ; cd .. - -ceg/as_instr.c : as_table # $(AS)/as_parser - cd ceg ; $(EM)/lib/cpp -P ../as_table| $(AS)/as_parser > as_instr.c ; cd .. - -ceg/eval_as.o : ceg/eval_as.c as.h # $(AS)/as_parser.h $(Em)/arg_type.h - cd ceg;$(CC) -c $(IFILES) eval_as.c ; cd .. - -ceg/eval_as.c : as.c # $(EVAL)/eval - cd ceg ; $(EVAL)/eval < ../as.c > eval_as.c ; cd .. +ceg/ceg: + make -f $(CEG_MAKE) diff --git a/util/ceg/util/update_ceg b/util/ceg/util/update_ceg index 9cca367ee..5c153fd7f 100755 --- a/util/ceg/util/update_ceg +++ b/util/ceg/util/update_ceg @@ -1,28 +1,28 @@ -make -f ce_makefile ceg/ceg +MAKE=../../../lib/ceg/util/make_ce + +make -f ceg/Makefile for i do case $i in - ALL) make -f ce_makefile EM_instr ce.a; - exit 0;; + ALL) make -f $MAKE ce.a + exit 0 + ;; - *.o) make -f ce_makefile ce/$i; - ar r ce.a $i;; + *.o) make -f $MAKE ce/$i + ;; - *..) ( cd ce; ../../../../lib/cpp ../EM_table| sed "/^#/d"| ../ceg/ceg -c $i); - F=`basename $i ..`; + *..) ( cd ce; ../../../../lib/cpp -P ../EM_table | ../ceg/ceg -c $i) + F=`basename $i ..` U="_dnam" V="_dlb" - make -f ce_makefile ce/$F.o ce/$F$U.o ce/"$F$V.o"; - echo ar r ce.a ce/$F.o ce/"$F$U.o" ce/"$F$V.o"; - ar r ce.a ce/$F.o ce/$F$U.o ce/"$F$U.o";; + make -f $MAKE ce/$F.o ce/$F$U.o ce/"$F$V.o" + ;; - *) ( cd ce; ../../../../lib/cpp ../EM_table| sed "/^#/d"| ../ceg/ceg -c $i); - make -f ce_makefile ce/$i.o; - echo ar r ce.a ce/$i.o; - ar r ce.a ce/$i.o;; + *) ( cd ce; ../../../../lib/cpp -P ../EM_table | ../ceg/ceg -c $i) + make -f $MAKE ce/$i.o + ;; esac done - -echo ranlib ce.a -ranlib ce.a +touch ce/dummy +make -f $MAKE ce.a