155 lines
4.7 KiB
Makefile
155 lines
4.7 KiB
Makefile
|
########## Variablendefinitionen ###########
|
||
|
|
||
|
# Revisions-Variablen
|
||
|
REVISIONS_NR := $(shell if test -d .svn; then svn -R info | grep ^Revision | cut -f2 -d " " | sort | tail -1; else date +%Y%m%d; fi)
|
||
|
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
|
||
|
linkchecker -r 4 --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 -d .svn ;\
|
||
|
then svn export cd-template "$(CCD_BUILD_DIR)" ;\
|
||
|
else mkdir -p $(dir $(CCD_BUILD_DIR)) ;\
|
||
|
cp -r cd-template $(CCD_BUILD_DIR) ;\
|
||
|
fi
|
||
|
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 -d .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
|
||
|
|