2005-04-23 22:35:52 +02:00
|
|
|
########## Variablendefinitionen ###########
|
|
|
|
|
2007-08-15 18:38:30 +02:00
|
|
|
# ist subversion verfuegbar?
|
|
|
|
IS_SVN := $(shell test -d .svn && which svn && echo "yes")
|
2005-12-12 21:47:35 +01:00
|
|
|
# Revisions-Variablen
|
2007-08-15 18:38:30 +02:00
|
|
|
REVISIONS_NR := $(shell test "yes" = "$(IS_SVN)" && svn -R info | grep ^Revision | cut -f2 -d " " | sort | tail -1)
|
|
|
|
# kein svn vorhanden? also nehmen wir das heutige Datum
|
|
|
|
REVISIONS_NR ?= $(shell date +%Y%m%d)
|
2005-05-15 20:23:56 +02:00
|
|
|
REVISIONS_SUFFIX = _r$(REVISIONS_NR)
|
2005-04-23 22:35:52 +02:00
|
|
|
|
|
|
|
# Verzeichnisse
|
|
|
|
ROOT_DIR := $(shell pwd)
|
2005-05-15 17:25:48 +02:00
|
|
|
|
|
|
|
# Ablage der erstellten zip/iso-Dateien
|
|
|
|
EXPORT_DIR = $(ROOT_DIR)/export
|
|
|
|
# so beginnt das export-Verzeichnis
|
2005-04-23 22:35:52 +02:00
|
|
|
EXPORT_PREFIX := cryptocd
|
2005-12-12 21:47:35 +01:00
|
|
|
# wird an das export-Verzeichnis und die Archiv/iso-Dateien angehaengt
|
2006-06-10 13:10:03 +02:00
|
|
|
EXPORT_FILE_SUFFIX :=
|
2005-05-15 17:25:48 +02:00
|
|
|
EXPORT_FILE = $(EXPORT_DIR)/$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)$(EXPORT_FILE_SUFFIX)
|
|
|
|
|
|
|
|
# Zwischenlagerung
|
2005-04-23 22:35:52 +02:00
|
|
|
TMP_ROOT = $(ROOT_DIR)/tmp
|
2007-08-15 18:38:30 +02:00
|
|
|
CCD_BUILD_DIR ?= $(TMP_ROOT)/$(EXPORT_PREFIX)$(REVISIONS_SUFFIX)$(EXPORT_FILE_SUFFIX)
|
2005-12-12 21:47:35 +01:00
|
|
|
PROGRAMM_DIR = $(CCD_BUILD_DIR)/programme
|
2005-05-15 17:25:48 +02:00
|
|
|
|
2005-12-12 21:47:35 +01:00
|
|
|
# Verzeichnisse, die notfalls erstellt werden muessen
|
|
|
|
CREATE_DIRS = $(TMP_ROOT) $(EXPORT_DIR)
|
2005-04-23 22:35:52 +02:00
|
|
|
|
|
|
|
# Aktionen
|
2005-04-24 14:46:10 +02:00
|
|
|
ERZEUGE_TAR = tar cjhf $(EXPORT_FILE).tar.bz2 -C $(dir $(CCD_BUILD_DIR)) $(notdir $(CCD_BUILD_DIR))
|
2006-06-11 03:48:17 +02:00
|
|
|
ERZEUGE_ZIP = (cd $(dir $(CCD_BUILD_DIR)); zip -9rq - $(notdir $(CCD_BUILD_DIR))) >$(EXPORT_FILE).zip
|
2005-12-12 21:47:35 +01:00
|
|
|
ERZEUGE_ISO = mkisofs -quiet $(ISO_OPTS) -o $(EXPORT_FILE).iso $(CCD_BUILD_DIR) 2>&1 | $(EINRUECKEN)
|
2005-04-23 22:35:52 +02:00
|
|
|
|
|
|
|
# Sonstiges
|
2005-05-15 17:25:48 +02:00
|
|
|
# Optionen fuer mkisofs
|
2005-04-23 22:35:52 +02:00
|
|
|
ISO_OPTS = -iso-level 3 -J -joliet-long -relaxed-filenames -f -r -V $(EXPORT_PREFIX)$(REVISIONS_SUFFIX)
|
2005-05-15 17:25:48 +02:00
|
|
|
# Ausgabe-Filter zum Einruecken
|
2005-04-23 22:35:52 +02:00
|
|
|
EINRUECKEN = sed 's/^/\t/'
|
|
|
|
|
2005-12-12 21:47:35 +01:00
|
|
|
######### Variablen vererben ###########
|
2005-04-24 16:54:04 +02:00
|
|
|
export CCD_BUILD_DIR
|
2005-04-23 22:35:52 +02:00
|
|
|
|
2005-05-15 17:25:48 +02:00
|
|
|
########### Allgemeine targets ###########
|
2005-04-23 22:35:52 +02:00
|
|
|
|
2006-06-11 03:48:17 +02:00
|
|
|
.PHONY : clean clean-dist all documents linkcheck help website release source all cd-template kopiere_programme
|
2005-04-23 22:35:52 +02:00
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "allgemeine Targets:"
|
|
|
|
@echo " help - diese Uebersicht"
|
|
|
|
@echo " doku - das Doku-Verzeichnis erneuern"
|
2006-06-09 23:21:33 +02:00
|
|
|
@echo " clean - unnoetige Dateien loeschen (ohne downloads)"
|
|
|
|
@echo " dist-clean - unnoetige Dateien loeschen (inklusive downloads)"
|
2006-06-11 03:48:17 +02:00
|
|
|
@echo " linkcheck - Pruefung der Links"
|
2005-12-12 21:47:35 +01:00
|
|
|
@echo " validate - Pruefung des html-Codes"
|
2005-04-23 22:35:52 +02:00
|
|
|
@echo
|
|
|
|
@echo "Export-Targets:"
|
2005-05-15 17:25:48 +02:00
|
|
|
@echo " source - die lyx-Quellen und Bilder"
|
2006-06-11 03:48:17 +02:00
|
|
|
@echo " website - fuer die Webseite: mit Programmen"
|
|
|
|
@echo " release - erstellt das iso-Image und das zip-Archiv"
|
2005-12-12 21:47:35 +01:00
|
|
|
@echo " all - erstellt alle Export-Formen"
|
2005-04-23 22:35:52 +02:00
|
|
|
|
2006-06-09 23:21:33 +02:00
|
|
|
|
2005-04-23 22:35:52 +02:00
|
|
|
clean:
|
2005-05-12 21:48:11 +02:00
|
|
|
-make -C documents clean
|
2006-07-27 02:10:18 +02:00
|
|
|
-rm -rf $(TMP_ROOT)/* 2>/dev/null
|
2006-06-09 23:21:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
dist-clean: clean
|
2006-06-11 03:48:17 +02:00
|
|
|
@# runtergeladene Dateien loeschen
|
2006-06-09 23:21:33 +02:00
|
|
|
@downloads/get_files.sh programme clean
|
2005-12-12 21:47:35 +01:00
|
|
|
|
2005-04-23 22:35:52 +02:00
|
|
|
|
2006-06-11 03:48:17 +02:00
|
|
|
linkcheck: doku kopiere_programme
|
2006-12-28 19:39:49 +01:00
|
|
|
@# 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
|
2006-08-06 08:16:10 +02:00
|
|
|
linkchecker -r 4 --ignore-url=^mailto: $(wildcard $(CCD_BUILD_DIR)/*.html)
|
2006-06-10 13:10:03 +02:00
|
|
|
|
|
|
|
|
2006-08-02 12:07:50 +02:00
|
|
|
validate:
|
|
|
|
make -C documents validate
|
2005-04-23 22:35:52 +02:00
|
|
|
|
2005-12-12 21:47:35 +01:00
|
|
|
|
2005-05-15 17:25:48 +02:00
|
|
|
# pruefe, ob alle notwendigen/empfohlenen Verzeichnisse existieren
|
2005-12-12 21:47:35 +01:00
|
|
|
verzeichnisstruktur: $(CREATE_DIRS)
|
|
|
|
$(CREATE_DIRS):
|
2006-07-29 18:23:30 +02:00
|
|
|
@if [ ! -e "$@" ] ;\
|
|
|
|
then echo -e "directory ($@) does not exist - I will create it" ;\
|
|
|
|
mkdir -p "$@" ;\
|
2005-04-24 16:54:04 +02:00
|
|
|
fi
|
|
|
|
|
2005-04-23 22:35:52 +02:00
|
|
|
######## die Werkzeuge #########
|
|
|
|
|
2005-04-24 14:46:10 +02:00
|
|
|
cd-template: verzeichnisstruktur
|
2005-04-24 16:54:04 +02:00
|
|
|
@rm -rf $(CCD_BUILD_DIR)
|
2006-07-27 02:10:18 +02:00
|
|
|
@# export local svn directory OR just copy the directories (for non-svn users)
|
2007-08-15 18:38:30 +02:00
|
|
|
if test "yes" = "$(IS_SVN)" ;\
|
2006-07-29 18:23:30 +02:00
|
|
|
then svn export cd-template "$(CCD_BUILD_DIR)" ;\
|
|
|
|
else mkdir -p $(dir $(CCD_BUILD_DIR)) ;\
|
|
|
|
cp -r cd-template $(CCD_BUILD_DIR) ;\
|
|
|
|
fi
|
2006-12-28 19:39:49 +01:00
|
|
|
@# 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 '{}' \;
|
2005-04-23 22:35:52 +02:00
|
|
|
|
2005-05-15 17:25:48 +02:00
|
|
|
|
2005-04-24 14:46:10 +02:00
|
|
|
doku: cd-template
|
|
|
|
@echo "Aktualisiere das Doku-Verzeichnis ..."
|
2006-04-21 11:23:10 +02:00
|
|
|
@make -C documents
|
2005-12-12 21:47:35 +01:00
|
|
|
@#Kopieren der Dateien ins das Abbild-Verzeichnis
|
2005-05-14 16:39:20 +02:00
|
|
|
@make -C documents install
|
2005-04-23 22:35:52 +02:00
|
|
|
|
2005-05-15 17:25:48 +02:00
|
|
|
|
2005-12-12 21:47:35 +01:00
|
|
|
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)"
|
2005-05-15 17:25:48 +02:00
|
|
|
|
2005-04-23 22:35:52 +02:00
|
|
|
|
|
|
|
####### die Ausgabe-Formate ###########
|
|
|
|
website: EXPORT_FILE_SUFFIX := _website
|
2005-12-12 21:47:35 +01:00
|
|
|
website: doku kopiere_programme
|
2005-04-23 22:35:52 +02:00
|
|
|
@echo "Erzeuge Archiv der online-Dateien ..."
|
2006-06-11 03:48:17 +02:00
|
|
|
@# Gruppen-Schreibrecht setzen (fuer eduforge)
|
|
|
|
@chmod -R g+rw $(TMP_ROOT)
|
2005-04-23 22:35:52 +02:00
|
|
|
@$(ERZEUGE_TAR)
|
|
|
|
|
|
|
|
|
|
|
|
source: EXPORT_FILE_SUFFIX := _src
|
2005-05-15 17:25:48 +02:00
|
|
|
source:
|
2006-07-29 18:23:30 +02:00
|
|
|
rm -rf "$(CCD_BUILD_DIR)"
|
2007-08-15 18:38:30 +02:00
|
|
|
@if test "yes" = "$(IS_SVN)" ;\
|
2006-07-29 18:23:30 +02:00
|
|
|
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
|
2005-04-23 22:35:52 +02:00
|
|
|
@echo "Erzeuge source-Archiv ..."
|
|
|
|
@$(ERZEUGE_TAR)
|
|
|
|
|
|
|
|
|
2005-12-13 00:26:52 +01:00
|
|
|
release: EXPORT_FILE_SUFFIX := _release
|
|
|
|
release: doku kopiere_programme
|
2006-12-18 16:00:38 +01:00
|
|
|
find . -type f -name \*.html -exec unix2dos '{}' \;
|
|
|
|
find . -type f -name \*.txt -exec unix2dos '{}' \;
|
|
|
|
find . -type f -name \*.css -exec unix2dos '{}' \;
|
2005-04-23 22:35:52 +02:00
|
|
|
@echo "Erzeuge iso-Image ..."
|
|
|
|
@$(ERZEUGE_ISO)
|
2006-06-11 03:48:17 +02:00
|
|
|
@echo "Erzeuge zip-Archiv ..."
|
|
|
|
@$(ERZEUGE_ZIP)
|
2005-04-23 22:35:52 +02:00
|
|
|
|
|
|
|
|
2005-12-12 21:47:35 +01:00
|
|
|
all:
|
2005-04-23 22:35:52 +02:00
|
|
|
@make website
|
2005-12-13 00:26:52 +01:00
|
|
|
@make release
|
2005-05-15 17:25:48 +02:00
|
|
|
@make source
|
2005-04-23 22:35:52 +02:00
|
|
|
|