]> rtime.felk.cvut.cz Git - linux-conf-perf.git/blobdiff - Makefile
Allow importing lcp_django from other python scripts
[linux-conf-perf.git] / Makefile
index a933cbb0d37822001740af1b06353a6dd6ecc202..76babfb829deeb2ed3e4061f994ee661a4f87204 100644 (file)
--- a/Makefile
+++ b/Makefile
-.PHONY: all help parse_kconfig write_config build run test clean clean_linux clean_buildroot mlinux mbuildroot deflinux distclean_linux distclean_buildroot distclean picosat init initialize permute
-
--include .conf.mk
+HELP=""
+include .conf.mk
+include .stamp/empty # This creates the .stamp directory
+
+HELPER_PROGRAMS = scripts/parse_kconfig/parse          \
+                 scripts/write_config/write_config     \
+                 scripts/allconfig/allconfig           \
+                 scripts/picosat-959/picosat
+
+HELP+="all         - Builds basic programs and prints message about next steps.\n"
+.PHONY: all
+all:  $(HELPER_PROGRAMS) .stamp/initram_cyclictest
+       mkdir -p $(CONF_LOG_FOLDER)
+       mkdir -p $(CONF_BUILD_FOLDER)
+
+.PHONY: help
+help:
+       @echo " help        - Prints this text"
+       @echo -e $(HELP)
 
-all: parse_kconfig write_config permute picosat
+HELP+="psql        - Launch PostgreSQL interactive terminal.\n"
+.PHONY: psql
+psql:
+       psql -d "$(CONF_DB_DATABASE)"
 
-help:
-       @echo "all         - Builds basic programs and prints message about next steps."
-       @echo "help        - Prints this text"
-       @echo "mbuildroot  - Calls 'make menuconfig' in buildroot folder. Use this for"
-       @echo "              buildroot configuration."
-       @echo "mlinux      - Calls 'make menuconfig' in linux folder. Use this for linux"
-       @echo "              configuration."
-       @echo "deflinux    - Executes 'make defconfig' in linux folder. This generates default"
-       @echo "              linux configuration for architecture specified in conf.py"
-       @echo "initialize  - Executes only initialization. Depending on configuration this"
-       @echo "              can take various amount of time."
-       @echo "test        - Executes boot and benchmark test. You should use this before"
-       @echo "              target run. This target is for testing if initial kernel"
-       @echo "              configuration, buildroot configuration and benchmark are"
-       @echo "              configured right."
-       @echo "run         - Executes loop of kernel building, booting and benchmark execution."
-       @echo "evaluate    - Creating result statistics from generated data."
-       @echo
-       @echo "clean               - Cleans all generated files. Except those in"
-       @echo "                      linux and buildroot."
-       @echo "distclean           - Cleans all configurations and generated files."
-       @echo "                      Including linux and buildroot."
-       @echo "clean_linux         - Executes 'make clean' in linux folder."
-       @echo "distclean_linux     - Executes 'make distclean' in linux folder."
-       @echo "clean_buildroot     - Executes 'make clean' in buildroot folder."
-       @echo "distclean_buildroot - Executes 'make distclean' in buildroot folder."
-
-mbuildroot: buildroot/.config buildroot/system/skeleton/usr/bin/linux-conf-perf
-       $(MAKE) -C buildroot menuconfig
+.PHONY: mbuildroot
+mbuildroot:
+       $(MAKE) -C tests/cyclictest/root/ menuconfig
 
+HELP+="mlinux      - Calls 'make menuconfig' in Linux folder. Use this for Linux\n"
+HELP+="              configuration.\n"
+.PHONY: mlinux
 mlinux:
-       ARCH=$(ARCH) $(MAKE) -C linux menuconfig
+       ARCH=$(CONF_KERNEL_ARCH) $(MAKE) -C $(CONF_LINUX_SOURCES) menuconfig
 
+HELP+="deflinux    - Executes 'make defconfig' in linux folder. This generates default\n"
+HELP+="              linux configuration.\n"
+.PHONY: deflinux
 deflinux:
-       ARCH=$(ARCH) $(MAKE) -C linux defconfig
+       ARCH=$(CONF_KERNEL_ARCH) $(MAKE) -C $(CONF_LINUX_SOURCES) defconfig
+
+HELP+="dot_config  - Generate dot_config file. This file is based on default Linux\n"
+HELP+="              configuration.\n"
+$(CONF_DOT_CONFIG): .conf.mk scripts/allconfig/allconfig $(CONF_LINUX_BUILD_FOLDER)/.config
+       scripts/allconfig/allconfig --env .conf.mk $(CONF_LINUX_SOURCES)/Kconfig $(CONF_LINUX_BUILD_FOLDER)/.config $@
 
+HELP+="initialize  - Executes only initialization.\n"
+.PHONY: initialize init
 init: initialize
-initialize: parse_kconfig picosat
+initialize: all
        scripts/initialize.py
 
-test: $(BUILDROOT_INITRAM) parse_kconfig
+HELP+="dbmigrate   - Migrate database.\n"
+.PHONY: initdb initialize_database dbmigrate
+initdb: initialize_database
+initialize_database: dbmigrate
+dbmigrate:
+       ./scripts/database/manage.py makemigrations
+       ./scripts/database/manage.py migrate
+
+HELP+="test        - Executes boot and benchmark test. You should use this before\n"
+HELP+="              target run. This target is for testing if initial kernel\n"
+HELP+="              configuration, buildroot configuration and benchmark are\n"
+HELP+="              configured right.\n"
+.PHONY: test
+test: scripts/parse_kconfig/parse .stamp/initram_cyclictest
        scripts/test.py
 
-run: parse_kconfig write_config picosat $(BUILDROOT_INITRAM)
+HELP+="run         - Executes loop of kernel building, booting and benchmark execution.\n"
+.PHONY: run
+run: all $(CONF_BUILD_FOLDER)/rules $(CONF_BUILD_FOLDER)/fixed
+       ln -sf ../dot_measure $(CONF_BUILD_FOLDER)
        scripts/loop.py
 
+$(CONF_BUILD_FOLDER)/rules $(CONF_BUILD_FOLDER)/symbol_map: .conf.mk $(CONF_LINUX_SOURCES)/Kconfig
+       scripts/parse_kconfig/parse -v --env .conf.mk $(CONF_LINUX_SOURCES)/Kconfig $(dir $@)
+
+$(CONF_BUILD_FOLDER)/allconfig: .conf.mk $(CONF_LINUX_SOURCES)/Kconfig $(CONF_LINUX_BUILD_FOLDER)/.config
+       scripts/allconfig/allconfig --env .conf.mk $(CONF_LINUX_SOURCES)/Kconfig $(CONF_LINUX_BUILD_FOLDER)/.config $@
+
+$(CONF_BUILD_FOLDER)/fixed $(CONF_BUILD_FOLDER)/measure: .conf.mk $(CONF_BUILD_FOLDER)/allconfig dot_measure
+       scripts/gen_fixed.py $(CONF_BUILD_FOLDER)/allconfig dot_measure
+
+.PHONY: evaluate
 evaluate:
-       @ #TODO
+       scripts/evaluate.py
 
+HELP+="\n"
+
+HELP+="clean           - Cleans all generated files. Except those in\n"
+HELP+="                  linux and buildroot.\n"
+.PHONY: clean
 clean:
        @$(MAKE) -C scripts/parse_kconfig clean
        @$(MAKE) -C scripts/write_config clean
+       @$(MAKE) -C scripts/allconfig clean
        @if [ -e scripts/picosat-959/makefile ]; then $(MAKE) -C scripts/picosat-959 clean; fi
        $(RM) .conf.mk
        $(RM) -r jobfiles
-       $(RM) $(NBSCRIPT)
-
-distclean: clean distclean_linux distclean_buildroot
-       $(RM) .conf.mk
 
+HELP+="clean_measure   - Removes working files used while measuring. After this,\n"
+HELP+="                  initializations has to be executed once again.\n"
+.PHONY: clean_measure
+clean_measure:
+       $(RM) -r configurations
+       $(RM) -r output
+       $(RM) -r result
+       $(RM) $(CONF_DOT_CONFIG)
+
+HELP+="clean_database  - Drop all entries in database.\n"
+.PHONY: cleandb clean_database
+cleandb: clean_database
+clean_database:
+       ./scripts/database/manage.py flush
+
+HELP+="distclean       - Cleans all configurations and generated files.\n"
+HELP+="                  Including linux and buildroot.\n"
+.PHONY: distclean
+distclean: clean distclean_linux distclean_buildroot clean_measure
+
+HELP+="clean_linux     - Executes 'make clean' in linux folder.\n"
+.PHONY: clean_linux
 clean_linux:
-       @$(MAKE) -C linux clean
+       @$(MAKE) -C $(CONF_LINUX_SOURCES) clean
 
+HELP+="distclean_linux - Executes 'make distclean' in linux folder.\n"
+.PHONY: distclean_linux
 distclean_linux:
-       @$(MAKE) -C linux distclean
+       @$(MAKE) -C $(CONF_LINUX_SOURCES) distclean
 
+.PHONY: clean_buildroot
 clean_buildroot:
-       @$(MAKE) -C scripts/buildroot clean
+       @$(MAKE) -C tests/cyclictest/root/ clean
 
+.PHONY: distclean_buildroot
 distclean_buildroot:
-       @$(MAKE) -C scripts/buildroot distclean
+       @$(MAKE) -C tests/cyclictest/root/ distclean
 
 #######################################
 
-.conf.mk: conf.py
+.conf.mk: conf.py .target targets/$(shell cat .target)/conf.py
        scripts/confmk.py
 
-parse_kconfig:
-       @$(MAKE) -C scripts/parse_kconfig/
-
-write_config:
-       @$(MAKE) -C scripts/write_config/
+.target:
+       $(error Please select target by writing it to .target file)
 
-permute:
-       @$(MAKE) -C scripts/permute/
+$(HELPER_PROGRAMS):
+       $(MAKE) -C $(dir $@)
 
-$(BUILDROOT_INITRAM): buildroot/.config buildroot/system/skeleton/usr/bin/linux-conf-perf
-       @$(MAKE) -C scripts/buildroot
+scripts/picosat-959/makefile:
+       cd $(dir $@) && ./configure
 
-buildroot/.config:
-       cp $(BUILDROOT_DEF_CONFIG) $@
+scripts/picosat-959/picosat: scripts/picosat-959/makefile
 
-buildroot/system/skeleton/usr/bin/linux-conf-perf:
-       cp $(BUILDROOT_INITSCRIPT) $@
-       cat $(BUILDROOT_INITTAB_DIRECTIVE) >> buildroot/system/skeleton/etc/inittab
-
-picosat: scripts/picosat-959/picosat
-scripts/picosat-959/picosat:
-       cd scripts/picosat-959 && ./configure
-       $(MAKE) -C scripts/picosat-959
-
-#######################################
+.stamp/initram_cyclictest: .conf.mk
+       $(MAKE) -C tests/cyclictest/root
+       touch $@
 
-$(PHASE_FILE): initialize
-$(SYMBOL_MAP_FILE): initialize
-$(RULES_FILE): initialize
-$(VARIABLE_COUNT_FILE): initialize
+.stamp/empty:
+       mkdir -p $(dir $@)
+       touch $@