cryptocd/Makefile

176 lines
6.8 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
PROG_DIR = $(ROOT_DIR)/programme
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_SUFFIX)
EXPORT_FILE = $(EXPORT_DIR)/$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)$(EXPORT_FILE_SUFFIX)
# 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"
####### Allgemeine targets ###########
.PHONY : clean all doku 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 doku clean
-rm -r $(TMP_ROOT)/* 2>/dev/null
check:
make -C doku
linkchecker -r 3 --intern='!^mailto:' --extern-strict-all start.html
####### 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 #########
verzeichnisstruktur:
$(if $(shell test ! -e $(TMP_ROOT)),$(error "the temporary directory ($(TMP_ROOT)) does not exist --- maybe you want to: (1) create a symlink: 'ln -s DIR_SOMEWHERE $(TMP_ROOT)' or (2) create a directory: 'mkdir $(TMP_ROOT)'"))
@-[ ! -e $(EXPORT_DIR) ] && $(error "the export directory ($(EXPORT_DIR)) does not exist --- maybe you want to: (1) create a symlink: 'ln -s DIR_SOMEWHERE $(EXPORT_DIR)' or (2) create a directory: 'mkdir $(EXPORT_DIR)'")
@-[ ! -e $(EXT_DIR) ] && $(error "the directory ($(EXT_DIR)) containing external content (programs and chaosradio) does not exist --- maybe you want to: (1) create a symlink: 'ln -s DIR_SOMEWHERE $(EXT_DIR)' or (2) create a directory: 'mkdir $(EXT_DIR)'")
@-[ ! -e $(EXT_DIR_PROGS) ] && $(warning "the directory ($(EXT_DIR_PROGS)) containing the necessary programs does not exist --- maybe you want to: (1) create a symlink: 'ln -s DIR_SOMEWHERE $(EXT_DIR_PROGS)' or (2) create a directory: 'mkdir $(EXT_DIR_PROGS)'")
@-[ ! -e $(EXT_DIR_CHAOSRADIO) ] && $(warning "the directory ($(EXT_DIR_CHAOSRADIO)) containing the chaosradio features does not exist --- maybe you want to: (1) create a symlink: 'ln -s DIR_SOMEWHERE $(EXT_DIR_CHAOSRADIO)' or (2) create a directory: 'mkdir $(EXT_DIR_CHAOSRADIO)'")
cd-template: verzeichnisstruktur
cp --remove-destination -rs cd-template/* $(CCD_BUILD_DIR)
doku: cd-template
@echo "Aktualisiere das Doku-Verzeichnis ..."
@make -C documents $(LINE_STATUS) install
setze_releaseinfos: cd-template
@echo "Passe version.txt an ..."
@cat version.txt | sed 's/REVISIONS_PLATZHALTER/$(ARBEITS_REVISION)/g; s/DATUMS_PLATZHALTER/$(REVISIONS_DATUM)/g' >$(CCD_BUILD_DIR)/version.txt
@echo "Erzeuge changelog.txt ..."
@svn log -r $(ARBEITS_REVISION):1 >$(CCD_BUILD_DIR)/changelog.txt
@todos $(CCD_BUILD_DIR)/changelog.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 ..."
@[ -e "$(ROOT_DIR)/programme" ] && ln -s "$(ROOT_DIR)/programme" "$(CCD_BUILD_DIR)" || (echo "Fehler: kein Programm-Verzeichnis ($(ROOT_DIR)/programme) gefunden!" >&2 ; false )
verlinke_chaosradio: cd-template
@echo "Erzeuge Links zu den ChaosRadio-Dateien ..."
@[ -e "$(ROOT_DIR)/ausLese/chaosradio" ] && ln -s "$(ROOT_DIR)/ausLese/chaosradio" "$(CCD_BUILD_DIR)/ausLese" || echo "Warnung: keine ChaosRadio-Dateien gefunden ($(ROOT_DIR)/ausLese/chaosradio) - ignoriert" >&2
####### 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