diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 162 |
1 files changed, 107 insertions, 55 deletions
@@ -1,60 +1,112 @@ -SUBDIRS = application-devel flash-memory frameworks kernel-devel linux-basics protocols realtime security misc distribution +# If no .config on main folder i have to create one +NONE := $(shell touch .config) +include .config -default: - make all +TOP_DIR := $(CURDIR) +PATHS := -all: - for dir in $(SUBDIRS) ; do \ - (cd $$dir && make $@); \ +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 := pdflatex +BUILD_COMMAND_BIB := bibtex +BUILD_DEBUG := -halt-on-error +BUILD_ARGS := --interaction=patchmode +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 + +# 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 $@ ); \ done +ifdef CONFIG_BUILD_MASTER_PRES + ($(MAKE) -C ./ -f Makefile build_master_pres ); +endif +ifdef CONFIG_BUILD_MASTER_HANDOUT + ($(MAKE) -C ./ -f Makefile build_master_handout ); +endif + +menuconfig: + $(KMCONFIG) Kconfig + +config: + $(KCONFIG) --oldaskconfig Kconfig + +oldconfig: + cp $@ $(CONFIG_FILE) + $(KCONFIG) --oldconfig Kconfig clean: - 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 -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 - mv _configpres.tex configpres.tex - mv _tailpres.tex tailpres.tex - rm configpres.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 + @echo "Cleaning" + rm -rf $(DEPLOY_FOLDER) + find -name "tmp*" -exec rm -f {} \; + for dir in $(PATHS) ; do \ + ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk $@ ); \ + 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 ); \ + 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 ); \ + ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk build_master_pres_end ); \ + done + +clean_master_pres: +ifneq ($(shell find . -name $(MASTER_PRES)*$(MASTER_END)), ) + find . -name $(MASTER_PRES)*$(MASTER_END) -exec rm {} \; +endif + +build_master_handout: clean_master_handout + @echo "Build master handout with: "$(obj-handout-y) + for dir in $(PATHS) ; do \ + ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk build_master_handout ); \ + ($(MAKE) -C $$dir -f $(CURDIR)/modules.mk build_master_handout_end ); \ + done + +clean_master_handout: +ifneq ($(shell find . -name $(MASTER_HANDOUT)*$(MASTER_END)), ) + find . -name $(MASTER_HANDOUT)*$(MASTER_END) -exec rm {} \; +endif + +%_defconfig: + cp $(CONFIG_FOLDER)/$@ $(CONFIG_FILE) + $(KCONFIG) --oldconfig Kconfig + +.PHONY: config oldconfig menuconfig build clean mrproper distclean clean_master_pres build_master_handout |
