-# Skript, das die neue Bibliothek zusammenbauen soll (30.05.05)
+# Skript, das die neue Bibliothek zusammenbauen soll (01.01.06)
-SRC_DIR = src
-OBJ_DIR = obj
-LIB_DIR = lib
+export SRC_DIR = src
+export OBJ_DIR = obj
+export LIB_DIR = lib
+export RECIPE_DIR = recipe
+export RECIPE_SUFFIX=.recipe
+export ENDBLOCK=$(H316)/snippets/endseq
+export ORG_LIBDIR=original
+export ORG_OBJDIR=org
-MODULES = uc f$$w4 f$$w1 pchar fpatch lpchar vpunch
+export MAKE
+
+MODULES = uc f$$w4 f$$w1 pchar fpatch lpchar vpunch font
FRTN_COMMAND = frtn
ASM_COMMAND = asm
LDC_COMMAND = ldc
-SRC_FILES = $(foreach obj, $(MODULES),$(obj).asm)
-OBJ_FILES = $(SRC_FILES:.asm=.obj)
-OBJ_FILES_FULL = $(foreach file, $(OBJ_FILES),$(OBJ_DIR)/$(file))
-#OWN_3=$(shell echo $(subst $$,\$$,$(OWN)) | dd conv=ucase 2>/dev/null)
+
+#############
+
+#SRC_FILES = $(foreach obj, $(MODULES),$(obj).asm)
+#OBJ_FILES = $(SRC_FILES:.asm=.obj)
+#OBJ_FILES_FULL = $(foreach file, $(OBJ_FILES),$(OBJ_DIR)/$(file))
+
##########################################
-libs : $(OBJ_FILES_FULL)
- buildlib.sh
-obj : $(OBJ_FILES_FULL)
+RECIPES=$(foreach recipe,$(shell ls $(RECIPE_DIR) | grep -v CVS),\
+ $(RECIPE_DIR)/$(recipe))
+
+LIBS=$(foreach lib,$(basename $(notdir $(RECIPES))),$(LIB_DIR)/$(lib).lib)
+
+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)
+
+OBJECT_FILES=$(foreach obj, $(MODULES), $(OBJ_DIR)/$(obj).obj)
+SOURCE_FILES=$(foreach obj, $(MODULES), $(SRC_DIR)/$(obj).asm)
+#************
-$(OBJ_FILES_FULL):$(OBJ_DIR)/%.obj:$(SRC_DIR)/%.asm
- @echo Building: $(subst $$,\$$,$@)
+all: $(LIBS)
+
+$(ORG_OBJECTS): $(ORG_LIBDIR)/*
+ ./buildlib.sh makeorg
+
+$(OBJECTS): $(OBJECT_FILES)
+
+$(OBJECT_FILES) : $(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm
+ @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 $$,\$$,$@))
-
+
+$(LIBS):$(LIB_DIR)/%.lib: $(RECIPE_DIR)/%$(RECIPE_SUFFIX) $(ORG_OBJECTS) $(OBJECTS)
+ buildlib.sh genlib $(RECIPE_DIR)/$(basename $(notdir $@))$(RECIPE_SUFFIX)
+
+
clean:
@echo Cleaning up.
@rm -rf $(OBJ_DIR) $(LIB_DIR) *.lst *.go
- @rm -f vpunch.asm $(SRC_DIR)/font.asm
- @$(MAKE) -s -C vpunch-help clean
@buildlib.sh clean
vpunch-help/use: vpunch-help/use.c vpunch-help/font_8x16.c
$(MAKE) -C vpunch-help use
src/font.asm: vpunch-help/use
- vpunch-help/use > src/font.asm
+ vpunch-help/use > $@
+
+.PHONY: clean all
-.PHONY: clean all org obj libs