1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

PyMite: fix nasty build bug with open file problem on Windows

In fact, the cause of that error was badly written makefile rule which
generated 5 same files 5 times. If used with make -j, it tried to open
the same files for writing at the same time. Windows doesn't like this.
This is fixed now.
This commit is contained in:
Oleg Semyonov 2013-03-25 02:03:35 +02:00
parent 9f0710f9d5
commit 8e7712a13f
3 changed files with 68 additions and 30 deletions

View File

@ -1,41 +1,75 @@
#
# Rules to add PYMite to a PiOS target
# Rules to add PyMite flight plan interpreter
#
PYMITE = $(FLIGHTLIB)/PyMite
PYMITELIB = $(PYMITE)/lib
PYMITEPLAT = $(PYMITE)/platform/openpilot
PYMITETOOLS = $(PYMITE)/tools
PYMITEVM = $(PYMITE)/vm
PYMITEINC = $(PYMITEVM)
PYMITEINC += $(PYMITEPLAT)
PYMITEINC += $(OUTDIR)
# Paths
PYMITE := $(FLIGHTLIB)/PyMite
PYMITELIB := $(PYMITE)/lib
PYMITEPLAT := $(PYMITE)/platform/openpilot
PYMITETOOLS := $(PYMITE)/tools
PYMITEVM := $(PYMITE)/vm
PYMITEINC := $(PYMITEVM)
PYMITEINC += $(PYMITEPLAT)
PYMITEINC += $(OUTDIR)
# List C source files here. (C dependencies are automatically generated.)
# use file-extension c for "c-only"-files
# Flight plans
FLIGHTPLANLIB ?= $(OPMODULEDIR)/FlightPlan/lib
FLIGHTPLANS ?= $(OPMODULEDIR)/FlightPlan/flightplans
## PyMite files and modules
SRC += $(OUTDIR)/pmlib_img.c
SRC += $(OUTDIR)/pmlib_nat.c
SRC += $(OUTDIR)/pmlibusr_img.c
SRC += $(OUTDIR)/pmlibusr_nat.c
PYSRC += $(wildcard ${PYMITEVM}/*.c)
PYSRC += $(wildcard ${PYMITEPLAT}/*.c)
PYSRC += ${foreach MOD, ${PYMODULES}, ${wildcard ${OPMODULEDIR}/${MOD}/*.c}}
SRC += $(PYSRC)
# Extra modules
PYMODULES ?= FlightPlan
EXTRAINCDIRS += $(PYMITEINC)
# Modules
PYSRC += $(foreach mod, $(PYMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c))
# Generate intermediate code
gencode: ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h
# PyMite virtual machine and platform files
PYSRC += $(wildcard $(PYMITEVM)/*.c)
PYSRC += $(wildcard $(PYMITEPLAT)/*.c)
$(PYSRC): gencode
# Autogenerated files
PYLIB += $(addprefix $(OUTDIR)/, pmlib_img.c pmlib_nat.c)
PYLIB += $(addprefix $(OUTDIR)/, pmlibusr_img.c pmlibusr_nat.c)
PYTHON = python
# Scripts
PYSCRIPTS += $(wildcard $(PYMITELIB)/*.py)
PYSCRIPTS += $(wildcard $(PYMITEPLAT)/*.py)
PYSCRIPTS += $(wildcard $(FLIGHTPLANLIB)/*.py)
PYSCRIPTS += $(wildcard $(FLIGHTPLANS)/*.py)
# Generate code for PyMite
${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/pmlibusr_nat.c ${OUTDIR}/pmfeatures.h: $(wildcard ${PYMITELIB}/*.py) $(wildcard ${PYMITEPLAT}/*.py) $(wildcard ${FLIGHTPLANLIB}/*.py) $(wildcard ${FLIGHTPLANS}/*.py)
@echo $(MSG_PYMITEINIT) $(call toprel, $@)
@$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -s --memspace=flash -o $(OUTDIR)/pmlib_img.c --native-file=$(OUTDIR)/pmlib_nat.c $(PYMITELIB)/list.py $(PYMITELIB)/dict.py $(PYMITELIB)/__bi.py $(PYMITELIB)/sys.py $(PYMITELIB)/string.py $(wildcard $(FLIGHTPLANLIB)/*.py)
@$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h
@$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py
$(PYSRC): | $(PYLIB) $(OUTDIR)/pmfeatures.h
$(OUTDIR)/pmfeatures.h: $(PYSCRIPTS)
@$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@)
$(V1) $(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $@
$(OUTDIR)/pmlib_img.c: | $(OUTDIR)/pmlib_nat.c
$(OUTDIR)/pmlib_nat.c: $(PYSCRIPTS)
@$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@)
$(V1) $(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -c -s --memspace=flash \
-f $(PYMITEPLAT)/pmfeatures.py \
-o $(OUTDIR)/pmlib_img.c \
--native-file=$(OUTDIR)/pmlib_nat.c \
$(PYMITELIB)/list.py \
$(PYMITELIB)/dict.py \
$(PYMITELIB)/__bi.py \
$(PYMITELIB)/sys.py \
$(PYMITELIB)/string.py \
$(wildcard $(FLIGHTPLANLIB)/*.py)
$(OUTDIR)/pmlibusr_img.c: | $(OUTDIR)/pmlibusr_nat.c
$(OUTDIR)/pmlibusr_nat.c: $(PYSCRIPTS)
@$(ECHO) $(MSG_PYMITEINIT) $(call toprel, $@)
$(V1) $(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -c -u \
-f $(PYMITEPLAT)/pmfeatures.py \
-o $(OUTDIR)/pmlibusr_img.c \
--native-file=$(OUTDIR)/pmlibusr_nat.c \
$(FLIGHTPLANS)/test.py
# Add to the source and include lists
SRC += $(PYSRC)
SRC += $(PYLIB)
EXTRAINCDIRS += $(PYMITEINC)
EXTRAINCDIRS += $(foreach mod, $(PYMODULES), $(OPMODULEDIR)/$(mod)/inc)

View File

@ -92,6 +92,7 @@ endif
# Optional component libraries
include $(FLIGHTLIB)/rscode/library.mk
#include $(FLIGHTLIB)/PyMite/pymite.mk
include $(ROOT_DIR)/make/apps-defs.mk
include $(ROOT_DIR)/make/common-defs.mk

View File

@ -90,5 +90,8 @@ else
SRC += $(OPTESTS)/$(TESTAPP).c
endif
# Optional component libraries
#include $(FLIGHTLIB)/PyMite/pymite.mk
include $(ROOT_DIR)/make/apps-defs.mk
include $(ROOT_DIR)/make/common-defs.mk