# If no .config on main folder i have to create one NONE := $(shell touch .config) include .config TOP_DIR := $(CURDIR) PATHS := CONFIG_PATH := $(CURDIR) CONFIG_FILE := .config CONFIG := $(CONFIG_PATH)/$(CONFIG_FILE) DEPLOY_FOLDER := deploy DEPLOY := $(CONFIG_PATH)/$(DEPLOY_FOLDER) HANDOUT_FOLDER := handouts HANDOUT :=$(DEPLOY)/$(HANDOUT_FOLDER) CONFIG_FOLDER := configs BUILD_COMMAND := xelatex BUILD_COMMAND_BIB := bibtex BUILD_DEBUG := -halt-on-error --interaction=errorstopmode BUILD_ARGS := BUILD := $(BUILD_COMMAND) $(BUILD_DEBUG) $(BUILD_ARGS) BUILD_BIB := $(BUILD_COMMAND_BIB) KCONFIG_PATH := ./kconfig-frontends/frontends KCONFIG := $(KCONFIG_PATH)/conf/conf KMCONFIG := $(KCONFIG_PATH)/mconf/mconf MASTER_PRES := tmp_master_pres MASTER_HANDOUT := tmp_master_handout MASTER_END := .tex HANDOUT_PREFIX := handout_ PRES_PREFIX := pres_ # Folder that should not include to build paths EXCLUDE_PATH := \ grep -v ./kconfig-frontends | \ grep -v ./.git | \ grep -v ./kernel-devel/module-basics/vain | \ grep -v ./kernel-devel/module-basics/vain_pci | \ grep -v ./kernel-devel/module-basics/vain_plat | \ grep -v ./examples # Search for all folders with Makfile MAKE_FILES = $(shell find . -mindepth 2 -name Makefile | $(EXCLUDE_PATH)) PATHS = $(dir $(MAKE_FILES)) export build: mkdir -p $(HANDOUT) for dir in $(PATHS) ; do \ ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk $@ >> log.txt); \ done ifdef CONFIG_BUILD_MASTER_PRES ($(MAKE) -C ./ -f Makefile build_master_pres >> log.txt); endif ifdef CONFIG_BUILD_MASTER_HANDOUT ($(MAKE) -C ./ -f Makefile build_master_handout >> log.txt); endif $(KMCONFIG): cd kconfig-frontends/ && ./configure && make $(KCONFIG): cd kconfig-frontends/ && ./configure && make menuconfig: $(KMCONFIG) $(KMCONFIG) Kconfig config: $(KCONFIG) $(KCONFIG) --oldaskconfig Kconfig oldconfig: $(KCONFIG) cp $@ $(CONFIG_FILE) $(KCONFIG) --oldconfig Kconfig clean: @echo "Cleaning" rm -rf $(DEPLOY_FOLDER) find -name "tmp*" -exec rm -f {} \; for dir in $(PATHS) ; do \ ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk $@ >> log.txt); \ done mrproper distclean: @echo "distclean" rm -f $(CONFIG_FILE) rm -f $(CONFIG_FILE).old rm -rf $(DEPLOY_FOLDER) find -name "tmp*" -exec rm -f {} \; for dir in $(PATHS) ; do \ ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk clean >> log.txt); \ done build_master_pres: clean_master_pres @echo "Build masterpres with: "$(obj-y) for dir in $(PATHS) ; do \ ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk build_master_pres >> log.txt); \ ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk build_master_pres_end >> log.txt); \ done rm -rf pdf rm -f *.aux rm -f *.log rm -f *.nav rm -f *.toc rm -f *.pdf rm -f *.snm rm -f *.bbl rm -f *.blg rm -f *.out rm -f *.vrb vorlesung:: mv configpres.tex _configpres.tex touch configpres.tex mv tailpres.tex _tailpres.tex touch tailpres.tex #pdflatex vorl1.tex #pdflatex vorl1.tex pdflatex vorl2.tex pdflatex vorl2.tex #pdflatex vorl3.tex #pdflatex vorl3.tex #pdflatex vorl4.tex #pdflatex vorl4.tex #pdflatex vorl5.tex #pdflatex vorl5.tex #pdflatex vorl.tex #pdflatex vorl.tex rm configpres.tex tailpres.tex mv _configpres.tex configpres.tex mv _tailpres.tex tailpres.tex mv confighandout.tex _confighandout.tex touch confighandout.tex mv tailhandout.tex _tailhandout.tex touch tailhandout.tex #TEXINPUTS=`pwd`/wise:.:$(TEXINPUTS) pdflatex handout.tex #TEXINPUTS=`pwd`/wise:.:$(TEXINPUTS) pdflatex handout.tex rm confighandout.tex tailhandout.tex mv _confighandout.tex confighandout.tex mv _tailhandout.tex tailhandout.tex pres:: mv configpres.tex _configpres.tex touch configpres.tex mv tailpres.tex _tailpres.tex touch tailpres.tex pdflatex pres_master.tex bibtex pres_master.aux pdflatex pres_master.tex pdflatex pres_master.tex rm configpres.tex tailpres.tex mv _configpres.tex configpres.tex mv _tailpres.tex tailpres.tex book:: mv confighandout.tex _confighandout.tex touch confighandout.tex mv tailhandout.tex _tailhandout.tex touch tailhandout.tex TEXINPUTS=`pwd`/wise:.:$(TEXINPUTS) pdflatex handout_master.tex bibtex handout_master.tex TEXINPUTS=`pwd`/wise:.:$(TEXINPUTS) pdflatex handout_master.tex TEXINPUTS=`pwd`/wise:.:$(TEXINPUTS) pdflatex handout_master.tex rm confighandout.tailhandout.tex mv _confighandout.tex confighandout.tex mv _tailhandout.tex tailhandout.tex pdf:: rm -rf pdf mkdir -p pdf/pres mkdir -p pdf/handout mkdir -p pdf/hints find . -name pres_*.pdf | xargs cp -t pdf/pres find . -name hints_*.pdf | xargs cp -t pdf/hints find . -name handout_*.pdf | xargs cp -t pdf/handout cd pdf/pres && \ pdfsam-console -o `pwd`/../pres.pdf -d `pwd` concat cd pdf/hints && \ pdfsam-console -o `pwd`/../hints.pdf -d `pwd` concat cd pdf/handout && \ pdfsam-console -o `pwd`/../handout.pdf -d `pwd` concat