aboutsummaryrefslogtreecommitdiff
path: root/py/mkenv.mk
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2014-01-24 01:05:30 -0800
committerDave Hylands <dhylands@gmail.com>2014-01-24 08:46:48 -0800
commitc89c681a9f065e66ce817a024fda24abeed9519f (patch)
tree5696bfbe38d0cb93e7ad0a9b0b14b353d99da740 /py/mkenv.mk
parent2b2cb7b7f4f467b67082f79053118df78f48e66e (diff)
Rework makefiles. Add proper dependency checking.
Diffstat (limited to 'py/mkenv.mk')
-rw-r--r--py/mkenv.mk52
1 files changed, 52 insertions, 0 deletions
diff --git a/py/mkenv.mk b/py/mkenv.mk
new file mode 100644
index 000000000..ed4e22096
--- /dev/null
+++ b/py/mkenv.mk
@@ -0,0 +1,52 @@
+ifneq ($(lastword a b),b)
+$(error These Makefiles require make 3.81 or newer)
+endif
+
+# Set TOP to be the path to get from the current directory (where make was
+# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
+# the name of this makefile relative to where make was invoked.
+#
+# We assume that this file is in the py directory so we use $(dir ) twice
+# to get to the top of the tree.
+
+THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
+TOP := $(patsubst %/py/mkenv.mk,%,$(THIS_MAKEFILE))
+
+# Turn on increased build verbosity by defining BUILD_VERBOSE in your main
+# Makefile or in your environment. You can also use V=1 on the make command
+# line.
+
+ifeq ("$(origin V)", "command line")
+BUILD_VERBOSE=$(V)
+endif
+ifndef BUILD_VERBOSE
+BUILD_VERBOSE = 0
+endif
+ifeq ($(BUILD_VERBOSE),0)
+Q = @
+else
+Q =
+endif
+# Since this is a new feature, advertise it
+ifeq ($(BUILD_VERBOSE),0)
+$(info Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.)
+endif
+
+# default settings; can be overriden in main Makefile
+
+PY_SRC ?= $(TOP)/py
+BUILD ?= build
+
+RM = rm
+ECHO = @echo
+
+AS = $(CROSS_COMPILE)as
+CC = $(CROSS_COMPILE)gcc
+LD = $(CROSS_COMPILE)ld
+OBJCOPY = $(CROSS_COMPILE)objcopy
+SIZE = $(CROSS_COMPILE)size
+
+all:
+.PHONY: all
+
+MKENV_INCLUDED = 1