summaryrefslogtreecommitdiffstats
path: root/makefile-djb/Makefile_base
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-04-23 10:00:14 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-04-23 10:00:14 +0200
commitddfc7cad49c8704240a0d36d2ff1f400beff1699 (patch)
treeee06220f037fb42c2de1f5a0b9d34808b37e0024 /makefile-djb/Makefile_base
parent48db83e5666b1bfd0c752f98f991dc83cb29dfb8 (diff)
downloadskeletons-ddfc7cad49c8704240a0d36d2ff1f400beff1699.zip
skeletons-ddfc7cad49c8704240a0d36d2ff1f400beff1699.tar.gz
add makefile-djb
Diffstat (limited to 'makefile-djb/Makefile_base')
-rw-r--r--makefile-djb/Makefile_base113
1 files changed, 113 insertions, 0 deletions
diff --git a/makefile-djb/Makefile_base b/makefile-djb/Makefile_base
new file mode 100644
index 0000000..ca1a94c
--- /dev/null
+++ b/makefile-djb/Makefile_base
@@ -0,0 +1,113 @@
+
+# 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 --exclude=*~ -chzf $${P}/$${ARCH} $${FILES} ' \
+ ) > 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` -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