genode/repos/base-pistachio/Makefile

68 lines
2.0 KiB
Makefile
Raw Normal View History

2011-12-22 15:19:25 +00:00
#
# \brief Checkout Pistachio and additional needed tools (kickstart)
2011-12-22 15:19:25 +00:00
# \author Stefan Kalkowski
# \date 2011-07-15
#
VERBOSE = @
ECHO = @echo
GIT_URI = https://github.com/l4ka/pistachio.git
GIT_REV = 76bac3d926dc707c6a3243b38c1505d2b5b6537b
2011-12-22 15:19:25 +00:00
CONTRIB_DIR = contrib
SHELL = bash
2011-12-22 15:19:25 +00:00
PATCHES = $(shell find patches -name *.patch)
#
# Utility to check if a tool is installed
#
check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.))
$(call check_tool,git)
$(call check_tool,patch)
$(call check_tool,sed)
$(call check_tool,autoheader)
$(call check_tool,autoconf)
#
# Determine python version to use for CML2
#
PYTHON2 := $(notdir $(lastword $(shell which python2 $(addprefix python2.,4 5 6 7 8))))
ifeq ($(PYTHON2),)
prepare: python_not_installed
python_not_installed:
$(ECHO) "Error: CML2 Configuration System needs Python 2 to be installed"
@false;
endif
2011-12-22 15:19:25 +00:00
#
# Print help information by default
#
help::
$(ECHO)
$(ECHO) "Check out upstream source code of Pistachio"
$(ECHO)
$(ECHO) "The source code will be located at the '$(CONTRIB_DIR)/' directory."
$(ECHO)
$(ECHO) "--- available commands ---"
$(ECHO) "prepare - checkout upstream source codes"
$(ECHO) "clean - remove upstream source codes"
$(ECHO)
$(CONTRIB_DIR):
$(VERBOSE)git clone $(GIT_URI) contrib
prepare: $(CONTRIB_DIR)
$(VERBOSE)cd $(CONTRIB_DIR); git fetch; git reset --hard $(GIT_REV)
$(ECHO) "applying patches to '$(CONTRIB_DIR)/'"
$(VERBOSE)for i in $(PATCHES); do patch -d $(CONTRIB_DIR) -p1 < $$i; done
2011-12-22 15:19:25 +00:00
@# use GCC front end for as linker for the pistachio user land
$(VERBOSE)sed -i "/LD=/s/^.*$$/LD=\$$(CC)/" $(CONTRIB_DIR)/user/config.mk.in
@# add '-Wl,' prefix to '-melf_*' linker options
$(VERBOSE)sed -i "s/-melf_/-Wl,-melf_/" `grep -rl melf_ $(CONTRIB_DIR)/user`
$(VERBOSE)for i in cmlcompile.py cmlconfigure.py configtrans.py; do \
sed -i "s/env python/env $(PYTHON2)/" $(CONTRIB_DIR)/contrib/cml2/$$i; done
2011-12-22 15:19:25 +00:00
$(VERBOSE)cd $(CONTRIB_DIR)/user; autoheader; autoconf;
clean::
$(VERBOSE)rm -rf $(CONTRIB_DIR)