.gitignore again
[h316.git] / lib / hachti / Makefile
1
2 # Skript, das die neue Bibliothek zusammenbauen soll (01.01.06)
3
4 export SRC_DIR = src
5 export OBJ_DIR = obj
6 export LIB_DIR = lib
7 export RECIPE_DIR = recipe
8 export RECIPE_SUFFIX=.recipe
9 export ENDBLOCK=$(H316)/snippets/endseq
10 export ORG_LIBDIR=original
11 export ORG_OBJDIR=org
12
13 export MAKE
14
15 MODULES = font pl$$mv pl$$txt pl$$u stack matrix oct liblok tt$$low\
16 megastore
17
18 F4_MODULES=pmat graphics
19
20 FRTN_COMMAND = frtn_original
21 ASM_COMMAND = asm_original
22 LDC_COMMAND = ldc -saq
23
24 include font.config
25
26 #############
27
28 RECIPES=$(foreach recipe,$(shell ls $(RECIPE_DIR) | egrep "recipe$$" | grep -v CVS),\
29 $(RECIPE_DIR)/$(recipe))
30
31 LIBS=$(foreach lib,$(basename $(notdir $(RECIPES))),$(LIB_DIR)/$(lib).lib)
32
33 OBJECTS=$(shell cat $(RECIPES)|egrep -v '^[[:space:]]*(\#.*)*$$'|\
34 grep $(OBJ_DIR)| sort -u)
35 #|sort -u
36
37 OBJECT_FILES=$(foreach obj, $(MODULES), $(OBJ_DIR)/$(obj).obj)
38 F4_OBJECT_FILES=$(foreach obj, $(F4_MODULES), $(OBJ_DIR)/$(obj).obj)
39 #ASM_FILES=$(foreach obj, $(MODULES), $(SRC_DIR)/$(obj).asm)
40 #FORTRAN_FILES=$(foreach obj, $(MODULES), $(SRC_DIR)/$(obj).f)
41 #************
42 #tmp:
43 # @echo $(subst $$,\$$, $(OBJECTS))
44
45 all: $(LIBS)
46 # @echo $(LIBS)
47 # @echo '$(F4_OBJECT_FILES)'
48
49 $(ORG_OBJDIR)/lastrun: $(ORG_LIBDIR)/*
50 @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi
51 @./buildlib.sh makeorg
52
53 $(OBJECTS): $(OBJECT_FILES) $(F4_OBJECT_FILES)
54 # @$(MAKE) $(subst $$,\$$,$?)
55
56 $(OBJECT_FILES):$(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm
57 @echo Building: $(subst $$,\$$,$@)
58 @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi
59 @ rm -f $@
60 @ cd $(OBJ_DIR) && $(ASM_COMMAND) ../$(subst $$,\$$,$^) $(LISTING)
61 @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@))
62
63
64 $(F4_OBJECT_FILES):$(OBJ_DIR)/%.obj : $(SRC_DIR)/%.f
65 # @echo Building: $(subst $$,\$$,$@)
66 @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi
67 @ rm -f $@
68 @ cd $(OBJ_DIR) && $(FRTN_COMMAND) ../$(subst $$,\$$,$^)
69 @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@))
70
71
72 $(LIBS):$(LIB_DIR)/%.lib: $(RECIPE_DIR)/%$(RECIPE_SUFFIX) $(OBJECTS)
73 @./buildlib.sh genlib $(RECIPE_DIR)/$(basename $(notdir $@))$(RECIPE_SUFFIX)
74
75 src/font.asm: font.config fonts/*.asm
76 @ln -sf $(shell pwd)/fonts/font_$(FONT).asm $(shell pwd)/src/font.asm
77
78 clean:
79 @rm -rf $(OBJ_DIR) $(LIB_DIR) *.lst *.go src/font.asm *.obj *~ *.par \
80 $(SRC_DIR)/*~ $(RECIPE_DIR)/*~
81 @./buildlib.sh clean
82
83 .PHONY: clean all
84
85 .PRECIOUS: org/lastrun
86