summaryrefslogtreecommitdiffstats
path: root/Makefile_base
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile_base')
-rw-r--r--Makefile_base112
1 files changed, 112 insertions, 0 deletions
diff --git a/Makefile_base b/Makefile_base
new file mode 100644
index 0000000..7bd0aa5
--- /dev/null
+++ b/Makefile_base
@@ -0,0 +1,112 @@
+
+# Don't edit this Makefile! Use conf-* for configuration.
+
+######################################
+
+SHELL=/bin/sh
+
+CYAN=\033[3;36m
+RED=\033[3;31m
+NORM=\033[0m
+
+default: build
+
+# GENERATE : buildarch - choose - compile - load - testflag
+
+buildarch: ${DIR}/warn-auto.sh conf-arch LICENSE README AUTHOR Changelog
+ @echo -e "$(CYAN)generating buildarch$(NORM)"
+ @( cat ${DIR}/warn-auto.sh; \
+ echo "ARCH=`head -1 conf-arch`"; \
+ echo 'echo -e "building $(RED)$${ARCH}$(NORM)"'; \
+ echo 'P=`pwd` && P=$${P##*/};'; \
+ echo 'FILES="$${P}/Makefile* $${P}/warn-auto.sh $${P}/LICENSE $${P}/README $${P}/AUTHOR $${P}/Changelog\
+ $${P}/conf-* $${P}/*.h* $${P}/*.c*";'; \
+ echo 'for I in $$@; do FILES="$${FILES} $${P}/$$I "; done;'; \
+ echo 'cd .. && tar -chzf $${P}/$${ARCH} $${FILES} 2>/dev/null' \
+ ) > buildarch
+ @chmod 755 buildarch
+
+choose: ${DIR}/warn-auto.sh
+ @echo -e "$(CYAN)generating choose$(NORM)"
+ @( cat ${DIR}/warn-auto.sh; \
+ echo 'result="$$3"'; \
+ echo 'case "$$1" in'; \
+ echo ' *c*) ./compile $$2.c >/dev/null 2>&1 || result="$$4" ;;'; \
+ echo 'esac'; \
+ echo 'case "$$1" in'; \
+ echo ' *l*) ./load c $$2 >/dev/null 2>&1 || result="$$4" ;;'; \
+ echo 'esac'; \
+ echo 'case "$$1" in'; \
+ echo ' *r*) ./$$2 >/dev/null 2>&1 || result="$$4" ;;'; \
+ echo 'esac'; \
+ echo 'rm -f $$2.o $$2'; \
+ echo 'cat $$result'; \
+ ) > choose
+ @chmod 755 choose
+
+compile: ${DIR}/warn-auto.sh conf-cc
+ @echo -e "$(CYAN)generating compile$(NORM)"
+ @( cat ${DIR}/warn-auto.sh; \
+ echo 'echo -e "`head -1 conf-cc` -c $(RED)$${1} $(NORM)"'; \
+ echo '`head -1 conf-cc` -c "$$1"'; \
+ ) > compile
+ @chmod 755 compile
+
+load: ${DIR}/warn-auto.sh conf-ld
+ @echo -e "$(CYAN)generating load$(NORM)"
+ @( cat ${DIR}/warn-auto.sh; \
+ echo 'choice=$$1; shift;'; \
+ echo 'name=$$1; shift;'; \
+ echo 'case "$$choice" in'; \
+ echo ' *c*)'; \
+ echo ' echo -e "`head -1 conf-ld` -o $(RED)$${name} $${name}.o $${1+"$$@"} $(NORM)"'; \
+ echo ' `head -1 conf-ld` -o "$$name" "$$name".o $${1+"$$@"}'; \
+ echo ' ;;'; \
+ echo ' *d*)'; \
+ echo ' echo -e "`head -1 conf-ld`$$name -o $(RED)$${name} $${1+"$$@"} $(NORM)"'; \
+ echo ' `head -1 conf-ld`"$$name" -o "$$name" $${1+"$$@"}'; \
+ echo ' ;;'; \
+ echo ' *s*)'; \
+ echo ' echo -e "ar -cr $(RED)$${name} $${1+"$$@"} $(NORM)"'; \
+ echo ' rm -f "$$name"; ar -cr "$$name" $${1+"$$@"}; ranlib "$$name"'; \
+ echo ' ;;'; \
+ echo 'esac'; \
+ ) > load
+ @chmod 755 load
+
+testflag: ${DIR}/warn-auto.sh
+ @echo -e "$(CYAN)generating testflag$(NORM)"
+ @( cat ${DIR}/warn-auto.sh; \
+ echo 'FLAG="$$1"; shift'; \
+ echo 'for I in "$$@"; do echo "#include \"$$I\""; done;'; \
+ echo 'echo "int main() {"'; \
+ echo 'echo "#ifdef "$$FLAG"" '; \
+ echo 'echo " return 0;"'; \
+ echo 'echo "#else"'; \
+ echo 'echo " return 1;"'; \
+ echo 'echo "#endif"'; \
+ echo 'echo }'; \
+ ) > testflag
+ @chmod 755 testflag
+
+# HIGH LEVEL GENERAL TARGETS
+buildstd:
+ @echo -e "$(CYAN)building `pwd`$(NORM)";
+ @for I in ${SUBDIR}; do \
+ ( echo -e "$(CYAN)building `pwd`/$$I$(NORM)" && cd $$I && make -s ); \
+ done;
+cleanstd:
+ @echo -e "$(CYAN)cleaning `pwd`$(NORM)";
+ @for I in ${SUBDIR}; do ( cd $$I && make -s clean ); done;
+ @if [ -f conf-arch ]; then if [ -f `head -1 conf-arch` ]; then rm `head -1 conf-arch`; fi; fi
+ @if [ -f buildarch ]; then rm buildarch; fi
+ @if [ -f choose ]; then rm choose; fi
+ @if [ -f compile ]; then rm compile; fi
+ @if [ -f load ]; then rm load; fi
+ @if [ -f testflag ]; then rm testflag; fi
+ @if [ "x`ls *~ 2>/dev/null`" != "x" ]; then rm *~; fi
+ @if [ "x`ls *.a 2>/dev/null`" != "x" ]; then rm *.a; fi
+ @if [ "x`ls *.o 2>/dev/null`" != "x" ]; then rm *.o; fi
+ @if [ "x`ls *.so* 2>/dev/null`" != "x" ]; then rm *.so*; fi
+
+# PACKAGE SPECIFIC TARGETS