182 lines
5.9 KiB
Makefile
182 lines
5.9 KiB
Makefile
|
########## Variablendefinitionen ###########
|
||
|
|
||
|
# ist subversion verfuegbar?
|
||
|
IS_SVN := $(shell test -d .svn && which svn >/dev/null && echo "yes")
|
||
|
# Revisions-Variablen
|
||
|
REVISIONS_NR := $(shell test "yes" = "$(IS_SVN)" && svn -R info | grep ^Revision | cut -f2 -d " " | sort -n | tail -1)
|
||
|
# kein svn vorhanden? also nehmen wir das heutige Datum
|
||
|
REVISIONS_NR ?= $(shell date +%Y%m%d)
|
||
|
REVISIONS_SUFFIX = _r$(REVISIONS_NR)
|
||
|
|
||
|
# Verzeichnisse
|
||
|
ROOT_DIR := $(shell pwd)
|
||
|
|
||
|
# Ablage der erstellten zip/iso-Dateien
|
||
|
EXPORT_DIR = $(ROOT_DIR)/export
|
||
|
# so beginnt das export-Verzeichnis
|
||
|
EXPORT_PREFIX := cryptocd
|
||
|
# wird an das export-Verzeichnis und die Archiv/iso-Dateien angehaengt
|
||
|
EXPORT_FILE_SUFFIX :=
|
||
|
EXPORT_FILE = $(EXPORT_DIR)/$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)$(EXPORT_FILE_SUFFIX)
|
||
|
|
||
|
# Zwischenlagerung
|
||
|
TMP_ROOT = $(ROOT_DIR)/tmp
|
||
|
CCD_BUILD_DIR ?= $(TMP_ROOT)/$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)$(EXPORT_FILE_SUFFIX)
|
||
|
PROGRAMM_DIR = $(CCD_BUILD_DIR)/programme
|
||
|
|
||
|
# Verzeichnisse, die notfalls erstellt werden muessen
|
||
|
CREATE_DIRS = $(TMP_ROOT) $(EXPORT_DIR)
|
||
|
|
||
|
# Aktionen
|
||
|
ERZEUGE_TAR = tar cjhf $(EXPORT_FILE).tar.bz2 -C $(dir $(CCD_BUILD_DIR)) $(notdir $(CCD_BUILD_DIR))
|
||
|
ERZEUGE_ZIP = (cd $(dir $(CCD_BUILD_DIR)); zip -9rq - $(notdir $(CCD_BUILD_DIR))) >$(EXPORT_FILE).zip
|
||
|
ERZEUGE_ISO = mkisofs -quiet $(ISO_OPTS) -o $(EXPORT_FILE).iso $(CCD_BUILD_DIR) 2>&1 | $(EINRUECKEN)
|
||
|
|
||
|
# Sonstiges
|
||
|
# Optionen fuer mkisofs
|
||
|
ISO_OPTS = -iso-level 3 -J -joliet-long -relaxed-filenames -f -r -V $(EXPORT_PREFIX)$(REVISIONS_SUFFIX)
|
||
|
# Ausgabe-Filter zum Einruecken
|
||
|
EINRUECKEN = sed 's/^/\t/'
|
||
|
|
||
|
######### Variablen vererben ###########
|
||
|
export CCD_BUILD_DIR
|
||
|
|
||
|
########### Allgemeine targets ###########
|
||
|
|
||
|
.PHONY : clean clean-dist all documents linkcheck help website release source all cd-template kopiere_programme
|
||
|
|
||
|
help:
|
||
|
@echo "allgemeine Targets:"
|
||
|
@echo " help - diese Uebersicht"
|
||
|
@echo " doku - das Doku-Verzeichnis erneuern"
|
||
|
@echo " clean - unnoetige Dateien loeschen (ohne downloads)"
|
||
|
@echo " dist-clean - unnoetige Dateien loeschen (inklusive downloads)"
|
||
|
@echo " linkcheck - Pruefung der Links"
|
||
|
@echo " validate - Pruefung des html-Codes"
|
||
|
@echo
|
||
|
@echo "Export-Targets:"
|
||
|
@echo " source - die lyx-Quellen und Bilder"
|
||
|
@echo " website - fuer die Webseite: mit Programmen"
|
||
|
@echo " release - erstellt das iso-Image und das zip-Archiv"
|
||
|
@echo " all - erstellt alle Export-Formen"
|
||
|
|
||
|
|
||
|
clean:
|
||
|
-make -C documents clean
|
||
|
-rm -rf $(TMP_ROOT)/* 2>/dev/null
|
||
|
|
||
|
|
||
|
dist-clean: clean
|
||
|
@# runtergeladene Dateien loeschen
|
||
|
@downloads/get_files.sh programme clean
|
||
|
|
||
|
|
||
|
linkcheck: doku kopiere_programme
|
||
|
@# check if the 'linkchecker' program is available
|
||
|
@if which linkchecker >/dev/null ;\
|
||
|
then true ;\
|
||
|
else echo >&2 ;\
|
||
|
echo >&2 "**********************************************************" ;\
|
||
|
echo >&2 "* Could not find 'linkchecker'! *" ;\
|
||
|
echo >&2 "* Debian users should run 'apt-get install linkchecker'. *" ;\
|
||
|
echo >&2 "**********************************************************";\
|
||
|
echo >&2 ;\
|
||
|
false ;\
|
||
|
fi
|
||
|
linkchecker -r 8 --ignore-url=^mailto: $(wildcard $(CCD_BUILD_DIR)/*.html)
|
||
|
|
||
|
|
||
|
validate:
|
||
|
make -C documents validate
|
||
|
|
||
|
|
||
|
# pruefe, ob alle notwendigen/empfohlenen Verzeichnisse existieren
|
||
|
verzeichnisstruktur: $(CREATE_DIRS)
|
||
|
$(CREATE_DIRS):
|
||
|
@if [ ! -e "$@" ] ;\
|
||
|
then echo -e "directory ($@) does not exist - I will create it" ;\
|
||
|
mkdir -p "$@" ;\
|
||
|
fi
|
||
|
|
||
|
######## die Werkzeuge #########
|
||
|
|
||
|
cd-template: verzeichnisstruktur
|
||
|
@rm -rf $(CCD_BUILD_DIR)
|
||
|
@# export local svn directory OR just copy the directories (for non-svn users)
|
||
|
@if test "yes" = "$(IS_SVN)" ;\
|
||
|
then svn export cd-template "$(CCD_BUILD_DIR)" ;\
|
||
|
else mkdir -p $(dir $(CCD_BUILD_DIR)) ;\
|
||
|
cp -r cd-template $(CCD_BUILD_DIR) ;\
|
||
|
fi
|
||
|
@# check if the 'unix2dos' program is available
|
||
|
@if which unix2dos >/dev/null ;\
|
||
|
then true ;\
|
||
|
else echo >&2 ;\
|
||
|
echo >&2 "*******************************************************" ;\
|
||
|
echo >&2 "* Could not find 'unix2dos'! *" ;\
|
||
|
echo >&2 "* Debian users should run 'apt-get install tofrodos'. *" ;\
|
||
|
echo >&2 "*******************************************************";\
|
||
|
echo >&2 ;\
|
||
|
false ;\
|
||
|
fi
|
||
|
@# use DOS linebreaks instead of unix-stylish ones - should be easy for everyone
|
||
|
@find $(CCD_BUILD_DIR) -type f -name \*.html -exec unix2dos '{}' \;
|
||
|
@find $(CCD_BUILD_DIR) -type f -name \*.txt -exec unix2dos '{}' \;
|
||
|
@find $(CCD_BUILD_DIR) -type f -name \*.css -exec unix2dos '{}' \;
|
||
|
|
||
|
|
||
|
doku: cd-template
|
||
|
@echo "Aktualisiere das Doku-Verzeichnis ..."
|
||
|
@make -C documents
|
||
|
@#Kopieren der Dateien ins das Abbild-Verzeichnis
|
||
|
@make -C documents install
|
||
|
|
||
|
|
||
|
kopiere_programme: cd-template
|
||
|
@echo "Kopiere die Programme ..."
|
||
|
@downloads/get_files.sh programme download
|
||
|
@downloads/get_files.sh programme verify
|
||
|
@downloads/get_files.sh programme install "$(PROGRAMM_DIR)"
|
||
|
|
||
|
|
||
|
####### die Ausgabe-Formate ###########
|
||
|
website: EXPORT_FILE_SUFFIX := _website
|
||
|
website: doku kopiere_programme
|
||
|
@echo "Erzeuge Archiv der online-Dateien ..."
|
||
|
@# Gruppen-Schreibrecht setzen (fuer eduforge)
|
||
|
@chmod -R g+rw $(TMP_ROOT)
|
||
|
@$(ERZEUGE_TAR)
|
||
|
|
||
|
|
||
|
source: EXPORT_FILE_SUFFIX := _src
|
||
|
source:
|
||
|
rm -rf "$(CCD_BUILD_DIR)"
|
||
|
@if test "yes" = "$(IS_SVN)" ;\
|
||
|
then mkdir -p "$(dir $(CCD_BUILD_DIR))" ;\
|
||
|
echo "Exportiere die gewaehlte svn-Revision ($(REVISIONS_NR)) ..." ;\
|
||
|
svn export . "$(CCD_BUILD_DIR)" | $(EINRUECKEN) ;\
|
||
|
else mkdir -p "$(CCD_BUILD_DIR)" ;\
|
||
|
make -C documents clean ;\
|
||
|
cp -r $(shell ls | grep -v "$(notdir $(TMP_ROOT))" | grep -v "$(notdir $(EXPORT_DIR))") "$(CCD_BUILD_DIR)" ;\
|
||
|
fi
|
||
|
@echo "Erzeuge source-Archiv ..."
|
||
|
@$(ERZEUGE_TAR)
|
||
|
|
||
|
|
||
|
release: EXPORT_FILE_SUFFIX := _release
|
||
|
release: doku kopiere_programme
|
||
|
find . -type f -name \*.html -exec unix2dos '{}' \;
|
||
|
find . -type f -name \*.txt -exec unix2dos '{}' \;
|
||
|
find . -type f -name \*.css -exec unix2dos '{}' \;
|
||
|
@echo "Erzeuge iso-Image ..."
|
||
|
@$(ERZEUGE_ISO)
|
||
|
@echo "Erzeuge zip-Archiv ..."
|
||
|
@$(ERZEUGE_ZIP)
|
||
|
|
||
|
|
||
|
all:
|
||
|
@make website
|
||
|
@make release
|
||
|
@make source
|
||
|
|