cryptocd/Makefile

183 lines
5.9 KiB
Makefile

########## Variablendefinitionen ###########
# Revision-Variablen
STABLE_REVISION := 143
AKTUELLE_REVISION := $(shell svn -R info| grep ^Revision| cut -f2 -d " " | sort | tail -1)
REVISIONS_SUFFIX = -r$(ARBEITS_REVISION)
REVISIONS_DATUM = $(shell svn log -r $(ARBEITS_REVISION) -q | grep -v "^---" | cut -d "|" -f 3)
# Verzeichnisse
ROOT_DIR := $(shell pwd)
EXPORT_DIR = $(ROOT_DIR)/export
EXT_DIR = $(ROOT_DIR)/extern
EXT_DIR_PROGS = $(EXT_DIR)/programme
EXT_DIR_CHAOSRADIO = $(EXT_DIR)/chaosradio
# der Name der export-Archive
EXPORT_PREFIX := cryptocd
TMP_ROOT = $(ROOT_DIR)/tmp
CCD_BUILD_DIR = $(TMP_ROOT)/$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)
EXPORT_FILE = $(EXPORT_DIR)/$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)$(EXPORT_FILE_SUFFIX)
ERROR_DIRS = $(TMP_ROOT) $(EXT_DIR) $(EXPORT_DIR) $(EXT_DIR_PROGS)
WARNING_DIRS = $(EXT_DIR_CHAOSRADIO)
# Aktionen
ERZEUGE_MIRROR = _scripts/erzeuge_export_mirror.sh $(MIRROR_QUELLE_DIR) $(CCD_BUILD_DIR)
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 -9qr $(EXPORT_FILE).zip $(notdir $(CCD_BUILD_DIR))
ERZEUGE_ISO = mkisofs $(ISO_OPTS) -o $(EXPORT_FILE).iso $(CCD_BUILD_DIR) 2>&1 | $(EINRUECKEN)
# Sonstiges
ISO_OPTS = -iso-level 3 -J -joliet-long -relaxed-filenames -f -r -V $(EXPORT_PREFIX)$(REVISIONS_SUFFIX)
EINRUECKEN = sed 's/^/\t/'
# Voreinstellungen
ARBEITS_REVISION = $(AKTUELLE_REVISION)
LINE_STATUS = offline
EXPORT_FILE_SUFFIX := undefiniert
# gilt nur fuer "release" und "release_all"
####### Variablen, die vererbt werden sollen ###########
export CCD_BUILD_DIR
####### Allgemeine targets ###########
.PHONY : clean all documents check help website website-stable release release-stable source source-stable export-all cd-template release_all release_all-stable setze_releaseinfos hole_svn_export svn_erzeuge_links verlinke_programme verlinke_chaosradio cd-template
all: doku
help:
@echo "allgemeine Targets:"
@echo " help - diese Uebersicht"
@echo " doku - das Doku-Verzeichnis erneuern"
@echo " all - dasselbe wie 'doku'"
@echo " clean - unnoetige Dateien loeschen"
@echo " check - Pruefung der Links"
@echo
@echo "Export-Targets:"
@echo " source[-stable] - die lyx-Quellen und Bilder"
@echo " release[-stable] - alles ausser Chaosradio"
@echo " release_all[-stable] - mit Chaosradio-Dateien"
@echo " website[-stable] - fuer die Webseite: mit Programmen, ohne Chaosradio"
@echo " export-all - erstellt alle Export-Formen (auch stable)"
clean:
@echo $(ICH)
-make -C documents clean
-rm -r $(TMP_ROOT)/* 2>/dev/null
check:
make -C doku
linkchecker -r 3 --intern='!^mailto:' --extern-strict-all start.html
verzeichnisstruktur: $(ERROR_DIRS) $(WARNING_DIRS)
$(ERROR_DIRS):
@if [ ! -e "$@" ] ; \
then echo -e "directory ($@) does not exist - it is required\n\tyou could symlink it or create this directory\n" ; \
false ; \
fi
$(WARNING_DIRS):
@[ ! -e "$@" ] && echo -e "directory ($@) does not exist - it is recommended\n\tyou could create a symlink or make this directory\n"
####### speziell fuer die stable-targets ###########
%-stable: ARBEITS_REVISION := $(STABLE_REVISION)
%-stable: MIRROR_QUELLE_DIR = $(TMP_ROOT)/svn-$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)
website: LINE_STATUS=online
release-stable: release
release_all-stable: release_all
source-stable: source
website-stable: website
######## die Werkzeuge #########
cd-template: verzeichnisstruktur
@rm -rf $(CCD_BUILD_DIR)
@cp --remove-destination -r cd-template $(CCD_BUILD_DIR)
@rm -rf `find $(CCD_BUILD_DIR) -type d -name ".svn"`
doku: cd-template
@echo "Aktualisiere das Doku-Verzeichnis ..."
@make -C documents $(LINE_STATUS) install
setze_releaseinfos: cd-template
@echo "Passe version.txt an ..."
sed -i 's/REVISIONS_PLATZHALTER/$(ARBEITS_REVISION)/g; s/DATUMS_PLATZHALTER/$(REVISIONS_DATUM)/g' $(CCD_BUILD_DIR)/version.txt
hole_quell_daten:
@if [ ! -e "$(MIRROR_QUELLE_DIR)" ] ;\
then mkdir -p $(shell dirname "$(MIRROR_QUELLE_DIR)") ;\
echo "Exportiere die gewaehlte svn-Revision ($(ARBEITS_REVISION)) ..." ;\
svn export -r $(ARBEITS_REVISION) . "$(MIRROR_QUELLE_DIR)" | $(EINRUECKEN) ;\
else echo "Verwende existierende lokale svn-Kopie" ;\
fi
verlinke_programme: cd-template
@echo "Erzeuge Links zu den Programmen ..."
@ln -s "$(EXT_DIR_PROGS)" "$(CCD_BUILD_DIR)/programme"
verlinke_chaosradio: cd-template
@echo "Erzeuge Links zu den ChaosRadio-Dateien ..."
@if [ -e "$(EXT_DIR_CHAOSRADIO)" ]; \
then ln -s "$(CCD_BUILD_DIR)/ausLese/chaosradio" "$(CCD_BUILD_DIR)/ausLese" ; \
else echo "Warnung: keine ChaosRadio-Dateien gefunden ($(ROOT_DIR)/ausLese/chaosradio) - ignoriert" >&2 ; \
fi
####### die Ausgabe-Formate ###########
website: EXPORT_FILE_SUFFIX := _website
website: cd-template verlinke_programme
@echo "Gruppen-Schreibrecht setzen (fuer eduforge) ..."
@# fuer die Zugriffsrechte auf dem eduforge-Server
@chmod -R g+rw $(TMP_ROOT)
@echo "Erzeuge Archiv der online-Dateien ..."
@$(ERZEUGE_TAR)
source: EXPORT_FILE_SUFFIX := _src
source: CCD_BUILD_DIR = $(MIRROR_QUELLE_DIR)
source: hole_quell_daten
@echo "Erzeuge source-Archiv ..."
@$(ERZEUGE_TAR)
release: EXPORT_FILE_SUFFIX := _small
release_all: EXPORT_FILE_SUFFIX := _all
release_all: verlinke_chaosradio verlinke_programme
release release_all: verlinke_programme setze_releaseinfos
@echo "Erzeuge zip-Archiv ..."
@$(ERZEUGE_ZIP)
@echo "Erzeuge iso-Image ..."
@$(ERZEUGE_ISO)
export-all:
@echo "Erstelle website ..."
@make website
#make website-stable
# klappt nicht wegen des restriktiven diffs
@echo "Erstelle aktuelles Quell-Paket ... "
@make source
@echo "Erstelle stabiles Quell-Paket ..."
@make source-stable
@echo "Erstelle kleine aktuelle Release-Pakete ..."
@make release
@echo "Erstelle kleine stabile Release-Pakete ..."
@make release-stable
@echo "Erstelle grosse aktuelle Release-Pakete ..."
@make release_all
@echo "Erstelle grosse stabile Release-Pakete ..."
@make release_all-stable