Changed everything towards LDC2 use.
authorhachti <hachti>
Wed, 30 May 2007 02:51:16 +0000 (02:51 +0000)
committerhachti <hachti>
Wed, 30 May 2007 02:51:16 +0000 (02:51 +0000)
Worked on the buildlib.sh.
Centralized  buildlib.sh to a new lib/common directory.

Makefile
bin/asm_original
bin/mklink.sh
bin/rmlink.sh
lib/common/buildlib.sh [new file with mode: 0755]
lib/fortran/Makefile
lib/fortran/buildlib.sh [deleted file]
lib/iolib/Makefile
lib/iolib/buildlib.sh [deleted file]
pc-tools/ldc2/src/main.cpp
pc-tools/ldc2/src/tool.hh

index 8480e37c3cda585ca91fa79352c34fbd2550b872..b6da4018c3093c54d132a84c3f2be9d1a19fb386 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # Toplevel Makefile for Hachti's H316 stuff collection
 
 # First we need the PC side tools. Nothing runs without them!
-SUBDIRS=pc-tools/ldc pc-tools/src-filters  pc-tools/boot-maker 
+SUBDIRS=pc-tools 
 
 # Now we build the libraries which are always rebuild using the original compiler and 
 # assembler tapes
@@ -27,12 +27,13 @@ SUBDIRS+=programs
 # If you want to build the docs, too: Uncomment next line:
 #SUBDIRS+=docs/manual
 
+
 default: 
        @mklink.sh
        @$(foreach subdir, $(SUBDIRS), $(MAKE) -C $(subdir)&&) /bin/true
 
 clean:
-       rmlink.sh
+       @rmlink.sh
        $(foreach subdir, $(SUBDIRS), $(MAKE) -C $(subdir) $@;)
 
 %:
index 7e2080df1bc7f803e726a54fc304ddae3999b9bd..f6becc4323a07e94179741f7eecf18902f47083a 100755 (executable)
@@ -6,7 +6,7 @@ if [ ! $1 ] ; then
     exit 2
 fi
 
-echo "Assembling $1 with original DAP 8K SLST!"
+echo -e "\nAssembler: Translating \"$1\" (Original DAP-16 8K SLST):"
 
 for n in $*; do
   if [ $n == "/v" ]; then
@@ -52,11 +52,11 @@ if cat $name.lst | grep "NO ERRORS IN ABOVE ASSEMBLY">/dev/null 2>&1; then
                rm -f $name.par
                rm -f $name.go
        fi
-       echo "DAP-16 assembly successfull :-)"
+       echo "Assembler: Success."
        exit 0
 fi
 cat $name.lst
-echo -e "\nDAP-16 assembly FAILED!"
+echo -e "Assembler: Failed."
 rm -f $name.obj
 exit 77
 
index 1a8fd9eb9abd230bd5f5b03f2aa46a868ca4b807..ae9ba4ad103818ece854972e1408b971d388d2f2 100755 (executable)
@@ -35,9 +35,16 @@ ln -s -f $H316/pc-tools/src-filters/paroff $H316/bin
 ln -s -f $H316/pc-tools/src-filters/tab    $H316/bin
 ln -s -f $H316/pc-tools/src-filters/zstrip $H316/bin
 
-ln -s -f $H316/pc-tools/ldc/ldc $H316/bin
+ln -s -f $H316/pc-tools/ldc2/ldc2 $H316/bin/ldc
 ln -s -f $H316/pc-tools/boot-maker/bmaker $H316/bin
 
 ln -s -f $H316/honeywell/lib/iolib35.lib $H316/lib/iolib/original/iolib35.lib
 
 ln -s -f $H316/honeywell/lib/flib{1,2,3}.lib $H316/lib/fortran/original
+
+for nb in `ls $H316/lib/common | grep -v CVS`; do
+       n=`basename "$nb"`
+       ln -s -f "$H316/lib/common/$n" $H316/lib/fortran
+       ln -s -f "$H316/lib/common/$n" $H316/lib/iolib
+done
+               
\ No newline at end of file
index a9d1e50f1eb13ec1f24ca3200344353173b76571..0cf9315fdf86096efd9203b3522075d022d967c2 100755 (executable)
@@ -37,3 +37,10 @@ rm -f $H316/bin/bmaker
 rm -f $H316/lib/iolib/original/iolib35.lib
 
 rm -f $H316/lib/fortran/original/flib{1,2,3}.lib
+
+for nb in `ls $H316/lib/common | grep -v CVS`; do 
+       n=`basename "$nb"`
+       rm -f "$H316/lib/fortran/$n"
+       rm -f "$H316/lib/iolib/$n"
+done   
+
diff --git a/lib/common/buildlib.sh b/lib/common/buildlib.sh
new file mode 100755 (executable)
index 0000000..b5de533
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+if [ ! "$MAKE" ]; then
+    echo "Not run from within Makefile!"
+    exit 4
+fi
+
+
+# The suffix for library files (in and out)
+LIB_SUFFIX=.lib
+#######################################################################
+IFS="
+"
+
+# Clean everything up
+clean() {
+    rm -rf $LIB_DIR $ORG_OBJDIR
+}
+
+# Generate org directory containing the original library objects
+make_org() {
+    if [ ! -d "$ORG_OBJDIR" ]; then
+       echo "Buildlib: Creating directory $ORG_OBJDIR."
+       mkdir  $ORG_OBJDIR
+    fi
+    tdir=$PWD
+    cd $ORG_OBJDIR
+    cat $tdir/$ORG_LIBDIR/*$LIB_SUFFIX | ldc -saq
+    cd $tdir
+    touch $ORG_OBJDIR/lastrun
+}
+
+genlib(){
+    if [ ! -d "$LIB_DIR" ]; then
+       echo -n "Creating $LIB_DIR:"
+       mkdir  $LIB_DIR && echo "Ok." || echo "FAILED!"
+    fi
+    
+    recipe=$1
+    lib=$LIB_DIR/`basename $recipe $RECIPE_SUFFIX`$LIB_SUFFIX
+       echo -e "\nBuildlib: Building library \"$lib\" using recipe \"$1\":"
+       rm -f $lib
+       for item in `cat $recipe| egrep -v '^[[:space:]]*(#.*)*$'`; do
+           iname=`echo $item | egrep -o '[^[:space:]].*[^[:space:]]' |sed 's/.obj$//g'`
+           echo "Buildlib: Appending \"$iname"\"
+           cat $iname >> $lib || (echo "Error! could not find:$item";exit 3)
+        done   
+           cat $ENDBLOCK >> $lib
+       echo "Buildlib: Done."
+}
+    
+case $1 in
+    clean)
+       clean
+       echo "Buildlib: Cleaning up."
+    ;;
+    makeorg)
+       echo "Buildlib: Splitting original libraries."
+       make_org
+    ;;
+    genlib)
+       genlib  $2
+    ;;
+    *)
+       clean
+       make_org
+       genlib
+    ;;
+esac
+
index 9fb1c4ff0a08fd6586f8cb80c5626e6ab4067914..3767ecd2be33b13bda0c3d9797f0c10c60ceb247 100644 (file)
@@ -15,7 +15,7 @@ MODULES = uc f$$w4 f$$w1 pchar fpatch lpchar reboot vpunch font
 
 FRTN_COMMAND = frtn_original
 ASM_COMMAND  = asm_original
-LDC_COMMAND  = ldc
+LDC_COMMAND  = ldc -saq
 
 #############
 
@@ -46,22 +46,22 @@ SOURCE_FILES=$(foreach obj, $(MODULES), $(SRC_DIR)/$(obj).asm)
 all: $(LIBS)
 
 $(ORG_OBJECTS): $(ORG_LIBDIR)/*
-       ./buildlib.sh makeorg
+       @./buildlib.sh makeorg
 
 $(OBJECTS): $(OBJECT_FILES)
 
 $(OBJECT_FILES) : $(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm
-       @echo Building: $(subst         $$,\$$,$@)
+#      @echo Building: $(subst         $$,\$$,$@)
        @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi
        @ rm -f $@
        @ cd $(OBJ_DIR) && $(ASM_COMMAND) ../$(subst $$,\$$,$^)
-       @ cd $(OBJ_DIR) && ldc -s -l $(notdir $(subst $$,\$$,$@))
+       @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@))
 
 $(LIBS):$(LIB_DIR)/%.lib: $(RECIPE_DIR)/%$(RECIPE_SUFFIX) $(ORG_OBJECTS) $(OBJECTS) 
        ./buildlib.sh genlib $(RECIPE_DIR)/$(basename $(notdir $@))$(RECIPE_SUFFIX)
 
 clean:
-       @echo Cleaning up.
+#      @echo Cleaning up.
        @rm -rf $(OBJ_DIR) $(LIB_DIR) src/font.asm  *.lst *.go 
        @$(MAKE) -C vpunch-help clean
        @./buildlib.sh clean
diff --git a/lib/fortran/buildlib.sh b/lib/fortran/buildlib.sh
deleted file mode 100755 (executable)
index 5362e87..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-
-if [ ! "$MAKE" ]; then
-    echo "Not run from within Makefile!"
-    exit 4
-fi
-
-
-# The suffix for library files (in and out)
-LIB_SUFFIX=.lib
-#######################################################################
-IFS="
-"
-
-# Clean everything up
-clean() {
-    rm -rf $LIB_DIR $ORG_OBJDIR
-}
-
-# Generate org directory containing the original library objects
-make_org() {
-    if [ ! -d "$ORG_OBJDIR" ]; then
-       mkdir  $ORG_OBJDIR
-    fi
-    tdir=$PWD
-    cd $ORG_OBJDIR
-    cat $tdir/$ORG_LIBDIR/*$LIB_SUFFIX | ldc -s -l
-    cd $tdir
-}
-
-genlib(){
-    echo "Library Builder start."
-    if [ ! -d "$LIB_DIR" ]; then
-       echo -n "Creating $LIB_DIR:"
-       mkdir  $LIB_DIR && echo "Ok." || echo "FAILED!"
-    fi
-    
-   # RECIPE_LIST=`ls $RECIPE_DIR/*$RECIPE_SUFFIX`
-   # for recipe in $RECIPE_LIST; do
-    recipe=$1
-    lib=$LIB_DIR/`basename $recipe $RECIPE_SUFFIX`$LIB_SUFFIX
-       echo "Building $lib:"
-       rm -f $lib
-       for item in `cat $recipe| egrep -v '^[[:space:]]*(#.*)*$'`; do
-           echo "appending $item."
-           cat `echo $item| egrep -o '[^[:space:]].*[^[:space:]]'` >> $lib || (echo "Error! could not find:$item")
-        done   
-           cat $ENDBLOCK >> $lib
-    #done
-}
-    
-
-case $1 in
-    clean)
-       echo "Clean!"
-       clean
-    ;;
-    makeorg)
-       echo "Make org!"
-       make_org
-    ;;
-    genlib)
-       echo "Build Lib!"
-       genlib  $2
-    ;;
-    *)
-       clean
-       make_org
-       genlib
-    ;;
-esac
-
index 5a2d8835e7d89010f98be029631ab6b3bc84dcd6..91d029972eee337b7207c1e37282ae5957013126 100644 (file)
@@ -15,7 +15,7 @@ MODULES = o$$al  o$$la o$$pl o$$pb i$$pa pl$$u pl$$mv
 
 FRTN_COMMAND = frtn_original
 ASM_COMMAND  = asm_original
-LDC_COMMAND  = ldc
+LDC_COMMAND  = ldc -saq
 
 #############
 
@@ -32,8 +32,8 @@ RECIPES=$(foreach recipe,$(shell ls $(RECIPE_DIR) | egrep "recipe$$" | grep -v C
 
 LIBS=$(foreach lib,$(basename $(notdir $(RECIPES))),$(LIB_DIR)/$(lib).lib)
 
-ORG_OBJECTS=$(shell cat $(RECIPES)|egrep -v '^[[:space:]]*(\#.*)*$$'|\
-                   grep $(ORG_OBJDIR)|sort -u) 
+#ORG_OBJECTS=$(shell cat $(RECIPES)|egrep -v '^[[:space:]]*(\#.*)*$$'|\
+#                   grep $(ORG_OBJDIR)|sort -u)        
 
 OBJECTS=$(shell cat $(RECIPES)|egrep -v '^[[:space:]]*(\#.*)*$$'|\
                    grep $(OBJ_DIR)|sort -u)
@@ -45,27 +45,32 @@ SOURCE_FILES=$(foreach obj, $(MODULES), $(SRC_DIR)/$(obj).asm)
 
 all: $(LIBS)
 
-$(ORG_OBJECTS): $(ORG_LIBDIR)/*
-       ./buildlib.sh makeorg
+
+$(ORG_OBJDIR)/lastrun: $(ORG_LIBDIR)/*
+       @./buildlib.sh makeorg
+
+#$(ORG_OBJECTS): $(ORG_LIBDIR)/*
+#      
+#      @echo '$(ORG_OBJECTS)'
 
 $(OBJECTS): $(OBJECT_FILES)
 
 $(OBJECT_FILES) : $(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm
-       @echo Building: $(subst         $$,\$$,$@)
+#      @echo Building: $(subst         $$,\$$,$@)
        @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi
        @ rm -f $@
        @ cd $(OBJ_DIR) && $(ASM_COMMAND) ../$(subst $$,\$$,$^)
-       @ cd $(OBJ_DIR) && ldc -s -l $(notdir $(subst $$,\$$,$@))
+       @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@))
 
-$(LIBS):$(LIB_DIR)/%.lib: $(RECIPE_DIR)/%$(RECIPE_SUFFIX) $(ORG_OBJECTS) $(OBJECTS) 
-       ./buildlib.sh genlib $(RECIPE_DIR)/$(basename $(notdir $@))$(RECIPE_SUFFIX)
+$(LIBS):$(LIB_DIR)/%.lib: $(RECIPE_DIR)/%$(RECIPE_SUFFIX) $(ORG_OBJDIR)/lastrun $(OBJECTS) 
+       @./buildlib.sh genlib $(RECIPE_DIR)/$(basename $(notdir $@))$(RECIPE_SUFFIX)
 
 
 clean:
-       @echo Cleaning up.
        @rm -rf $(OBJ_DIR) $(LIB_DIR)  *.lst *.go 
        @./buildlib.sh clean
 
 .PHONY: clean all
 
+.PRECIOUS: org/lastrun
 
diff --git a/lib/iolib/buildlib.sh b/lib/iolib/buildlib.sh
deleted file mode 100755 (executable)
index 7486ba5..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-
-if [ ! "$MAKE" ]; then
-    echo "Not run from within Makefile!"
-    exit 4
-fi
-
-
-# The suffix for library files (in and out)
-LIB_SUFFIX=.lib
-#######################################################################
-IFS="
-"
-
-# Clean everything up
-clean() {
-    rm -rf $LIB_DIR $ORG_OBJDIR
-}
-
-# Generate org directory containing the original library objects
-make_org() {
-    if [ ! -d "$ORG_OBJDIR" ]; then
-       mkdir  $ORG_OBJDIR
-    fi
-    tdir=$PWD
-    cd $ORG_OBJDIR
-    cat $tdir/$ORG_LIBDIR/*$LIB_SUFFIX | ldc -s -l
-    cd $tdir
-}
-
-genlib(){
-    echo "Library Builder start."
-    if [ ! -d "$LIB_DIR" ]; then
-       echo -n "Creating $LIB_DIR:"
-       mkdir  $LIB_DIR && echo "Ok." || echo "FAILED!"
-    fi
-    
-   # RECIPE_LIST=`ls $RECIPE_DIR/*$RECIPE_SUFFIX`
-   # for recipe in $RECIPE_LIST; do
-    recipe=$1
-    lib=$LIB_DIR/`basename $recipe $RECIPE_SUFFIX`$LIB_SUFFIX
-       echo "Building $lib:"
-       rm -f $lib
-       for item in `cat $recipe| egrep -v '^[[:space:]]*(#.*)*$'`; do
-           echo "appending $item."
-           cat $item >> $lib || (echo "Error! could not find:$item")
-        done   
-           cat $ENDBLOCK >> $lib
-    #done
-}
-    
-
-case $1 in
-    clean)
-       echo "Clean!"
-       clean
-    ;;
-    makeorg)
-       echo "Make org!"
-       make_org
-    ;;
-    genlib)
-       echo "Build Lib!"
-       genlib  $2
-    ;;
-    *)
-       clean
-       make_org
-       genlib
-    ;;
-esac
-
index 35f4ce632b4d10636a6764783c6993819f914a6c..d2270b68aaffdeeb5d8169b1582a714afb13d31d 100644 (file)
@@ -2,11 +2,16 @@
  * 
  * LDC2 source code
  *
- * $Date: 2007/03/26 03:20:31 $
+ * $Date: 2007/05/30 02:51:16 $
  * $Author: hachti $
  *
  * $Log: main.cpp,v $
- * Revision 2.2  2007/03/26 03:20:31  hachti
+ * Revision 2.3  2007/05/30 02:51:16  hachti
+ * Changed everything towards LDC2 use.
+ * Worked on the buildlib.sh.
+ * Centralized  buildlib.sh to a new lib/common directory.
+ *
+ * Revision 2.2  2007-03-26 03:20:31  hachti
  * *** empty log message ***
  *
  * Revision 2.1  2007-03-26 01:15:21  hachti
@@ -273,9 +278,9 @@ void process_tape(){
       
       // Open file for split objects
       if (cfg_split_objects && (block->get_type()!=tape_block::TBT_EOT)){
-       if (objname=="UNKNOWN")snprintf(filename,99,"UNKNOWN%02i.obj",
+       if (objname=="UNKNOWN")snprintf(filename,99,"UNKNOWN%02i",
                                        unknown_count);
-       else snprintf(filename,99,"%s.obj",objname.c_str());
+       else snprintf(filename,99,"%s",objname.c_str());
        if (fd>-1) close (fd);
        if (cfg_verbose) fprintf(stdwarn,"Writing file: %s\n",filename);
        fd=open(filename,O_WRONLY|O_CREAT|O_TRUNC,0666);
@@ -289,7 +294,7 @@ void process_tape(){
       }
 
       // Open file for split objects numbered
-      snprintf(filename_numbered,99,"%03i0-%s.obj",obj_no,objname.c_str());
+      snprintf(filename_numbered,99,"%03i0-%s",obj_no,objname.c_str());
       if (cfg_split_objects_numbered){
        close (fd_numbered);
        if (cfg_verbose) fprintf(stdwarn,"Writing file: %s\n",filename_numbered);
index 4919b65800c08fa12264dd59d29e1c61b18e1346..1f5008b281d224ef201a077cb5e111ff4f3f1604 100644 (file)
@@ -2,11 +2,16 @@
  * 
  * LDC2 source code
  *
- * $Date: 2007/03/26 01:00:40 $
+ * $Date: 2007/05/30 02:51:16 $
  * $Author: hachti $
  *
  * $Log: tool.hh,v $
- * Revision 2.0  2007/03/26 01:00:40  hachti
+ * Revision 2.1  2007/05/30 02:51:16  hachti
+ * Changed everything towards LDC2 use.
+ * Worked on the buildlib.sh.
+ * Centralized  buildlib.sh to a new lib/common directory.
+ *
+ * Revision 2.0  2007-03-26 01:00:40  hachti
  * *** empty log message ***
  *
  *
@@ -39,7 +44,7 @@ void merge_vector_unique(vector<T> &target, const vector<T> & source){
        already_present=true;
        break;
       }
-    if (!already_present) target.insert(target.end(),source[isource]);
+    if (!already_present) target.insert(target.begin(),source[isource]);
   }
 }