build: Simplify build directory layout by putting all headers in genhdr.

Any generated headers go in $(BUILD)/genhdr/, and are #included as
'genhdr/xxx.h'.
pull/512/head
Damien George 2014-04-17 18:03:27 +01:00
rodzic 2d1f865d16
commit d553be5982
18 zmienionych plików z 27 dodań i 32 usunięć

Wyświetl plik

@ -10,7 +10,7 @@ CROSS_COMPILE = arm-none-eabi-
INC = -I.
INC += -I$(PY_SRC)
INC += -I$(BUILD)/includes
INC += -I$(BUILD)
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 $(CFLAGS_CORTEX_M4) $(COPT)

Wyświetl plik

@ -51,24 +51,21 @@ $(BUILD)/%.pp: %.c
# The following rule uses | to create an order only prereuisite. Order only
# prerequisites only get built if they don't exist. They don't cause timestamp
# checkng to be performed.
# checking to be performed.
#
# $(sort $(var)) removes duplicates
#
# The net effect of this, is it causes the objects to depend on the
# object directories (but only for existance), and the object directories
# object directories (but only for existence), and the object directories
# will be created if they don't exist.
OBJ_DIRS = $(sort $(dir $(OBJ)))
$(OBJ): $(HEADER_PY_BUILD)/qstrdefs.generated.h | $(OBJ_DIRS)
$(OBJ): $(HEADER_BUILD)/qstrdefs.generated.h | $(OBJ_DIRS)
$(OBJ_DIRS):
$(MKDIR) -p $@
$(HEADER_BUILD):
$(MKDIR) -p $@
$(HEADER_PY_BUILD):
$(MKDIR) -p $@
ifneq ($(PROG),)
# Build a standalone executable (unix and unix-cpy do this)

Wyświetl plik

@ -2,10 +2,7 @@
PY_BUILD = $(BUILD)/py
# where autogenerated header files go
HEADER_BUILD = $(BUILD)/includes/build
# where autogenerated py header files go
HEADER_PY_BUILD = $(HEADER_BUILD)/py
HEADER_BUILD = $(BUILD)/genhdr
# file containing qstr defs for the core Python bit
PY_QSTR_DEFS = $(PY_SRC)/qstrdefs.h
@ -105,25 +102,26 @@ PY_O = $(addprefix $(PY_BUILD)/, $(PY_O_BASENAME))
FORCE:
.PHONY: FORCE
$(HEADER_PY_BUILD)/py-version.h: FORCE
$(HEADER_BUILD)/py-version.h: FORCE
$(Q)$(PY_SRC)/py-version.sh > $@.tmp
$(Q)if [ -f "$@" ] && cmp -s $@ $@.tmp; then rm $@.tmp; else echo "Generating $@"; mv $@.tmp $@; fi
# qstr data
# Adding an order only dependency on $(HEADER_PY_BUILD) causes $(HEADER_PY_BUILD) to get
# Adding an order only dependency on $(HEADER_BUILD) causes $(HEADER_BUILD) to get
# created before we run the script to generate the .h
$(HEADER_PY_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqstrdata.py mpconfigport.h $(PY_SRC)/mpconfig.h | $(HEADER_PY_BUILD)
$(HEADER_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqstrdata.py mpconfigport.h $(PY_SRC)/mpconfig.h | $(HEADER_BUILD)
$(ECHO) "CPP $<"
$(Q)$(CPP) $(CFLAGS) $(PY_QSTR_DEFS) -o $(HEADER_BUILD)/qstrdefs.preprocessed.h
$(ECHO) "makeqstrdata $(PY_QSTR_DEFS) $(QSTR_DEFS)"
$(CPP) $(CFLAGS) $(PY_QSTR_DEFS) -o $(HEADER_PY_BUILD)/qstrdefs.preprocessed.h
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py $(HEADER_PY_BUILD)/qstrdefs.preprocessed.h $(QSTR_DEFS) > $@
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/qstrdefs.preprocessed.h $(QSTR_DEFS) > $@
# We don't know which source files actually need the generated.h (since
# it is #included from str.h). The compiler generated dependencies will cause
# the right .o's to get recompiled if the generated.h file changes. Adding
# an order-only dependendency to all of the .o's will cause the generated .h
# to get built before we try to compile any of them.
$(PY_O): | $(HEADER_PY_BUILD)/qstrdefs.generated.h $(HEADER_PY_BUILD)/py-version.h
$(PY_O): | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/py-version.h
# emitters

Wyświetl plik

@ -60,7 +60,7 @@ const static qstr_pool_t const_pool = {
(const byte*) "\0\0\0\0", // invalid/no qstr has empty data
(const byte*) "\0\0\0\0", // empty qstr
#define Q(id, str) str,
#include "build/py/qstrdefs.generated.h"
#include "genhdr/qstrdefs.generated.h"
#undef Q
},
};

Wyświetl plik

@ -8,7 +8,7 @@ enum {
MP_QSTR_NULL = 0, // indicates invalid/no qstr
MP_QSTR_ = 1, // the empty qstr
#define Q(id, str) MP_QSTR_##id,
#include "build/py/qstrdefs.generated.h"
#include "genhdr/qstrdefs.generated.h"
#undef Q
MP_QSTR_number_of,
};

Wyświetl plik

@ -19,7 +19,7 @@ CROSS_COMPILE = arm-none-eabi-
INC = -I.
INC += -I$(PY_SRC)
INC += -I$(BUILD)/includes
INC += -I$(BUILD)
INC += -I$(CMSIS_DIR)
INC += -I$(STMPERIPH_DIR)
INC += -I$(STMUSB_DIR)

Wyświetl plik

@ -18,7 +18,7 @@ CROSS_COMPILE = arm-none-eabi-
INC = -I.
INC += -I$(PY_SRC)
INC += -I$(BUILD)/includes
INC += -I$(BUILD)
INC += -I$(CMSIS_DIR)/inc
INC += -I$(CMSIS_DIR)/devinc
INC += -I$(HAL_DIR)/inc

Wyświetl plik

@ -10,7 +10,7 @@
#include "runtime.h"
#include "adc.h"
#include "pin.h"
#include "build/pins.h"
#include "genhdr/pins.h"
#include "timer.h"
// Usage Model:

Wyświetl plik

@ -10,7 +10,7 @@
#include "timer.h"
#include "led.h"
#include "pin.h"
#include "build/pins.h"
#include "genhdr/pins.h"
typedef struct _pyb_led_obj_t {
mp_obj_base_t base;

Wyświetl plik

@ -134,7 +134,7 @@ static const char fresh_main_py[] =
;
static const char fresh_pybcdc_inf[] =
#include "build/pybcdc_inf.h"
#include "genhdr/pybcdc_inf.h"
;
static const char fresh_readme_txt[] =

Wyświetl plik

@ -22,7 +22,7 @@
#include "readline.h"
#include "pyexec.h"
#include "usb.h"
#include "build/py/py-version.h"
#include "genhdr/py-version.h"
pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL;
STATIC bool repl_display_debugging_info = 0;

Wyświetl plik

@ -9,7 +9,7 @@
#include "runtime.h"
#include "sdcard.h"
#include "pin.h"
#include "build/pins.h"
#include "genhdr/pins.h"
#if MICROPY_HW_HAS_SDCARD

Wyświetl plik

@ -11,7 +11,7 @@
#include "exti.h"
#include "gpio.h"
#include "pin.h"
#include "build/pins.h"
#include "genhdr/pins.h"
// Usage Model:
//

Wyświetl plik

@ -20,7 +20,7 @@ CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -fsingle-precision-c
INC = -I.
INC += -I$(PY_SRC)
INC += -I$(BUILD)/includes
INC += -I$(BUILD)
INC += -I$(CORE_PATH)
CFLAGS = $(INC) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4)

Wyświetl plik

@ -8,7 +8,7 @@ include ../py/py.mk
INC = -I.
INC += -I$(PY_SRC)
INC += -I$(BUILD)/includes
INC += -I$(BUILD)
# compiler settings
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX

Wyświetl plik

@ -12,7 +12,7 @@ include ../py/py.mk
INC = -I.
INC += -I$(PY_SRC)
INC += -I$(BUILD)/includes
INC += -I$(BUILD)
# compiler settings
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT)

Wyświetl plik

@ -22,7 +22,7 @@
#include "runtime.h"
#include "repl.h"
#include "gc.h"
#include "build/py/py-version.h"
#include "genhdr/py-version.h"
#if MICROPY_USE_READLINE
#include <readline/readline.h>

Wyświetl plik

@ -11,7 +11,7 @@ include ../py/py.mk
INC = -I.
INC += -I$(PY_SRC)
INC += -I$(BUILD)/includes
INC += -I$(BUILD)
# compiler settings
CFLAGS = $(INC) -Wall -Werror -ansi -std=gnu99 -DUNIX