Skip to content

Commit

Permalink
See whether we can build on both windows as linux with the same make …
Browse files Browse the repository at this point in the history
…files for stm32 by making the tools platform dependent.
  • Loading branch information
tljdebrouwer committed Jan 5, 2018
1 parent 54e1067 commit f96e01e
Showing 1 changed file with 50 additions and 13 deletions.
63 changes: 50 additions & 13 deletions OCAMicro/OCAMicro/Src/makeCpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,40 @@ ifneq ($(PLATFORM),)
INTDIR := $(OUTDIR)/$(OBJINT)/$(NAME)

# Tools
SD := gcc -M
SE := sed
RM := rm -f
MD := mkdir -p
RN := mv _PATH__OLDNAME_ _NEWNAME_
RD := rm -rf
RC :=
ifeq ($(OS),Windows_NT)
SD := gcc -M
SE := sed
RM := erase /F
MD := mkdir
RN := ren _PATH__OLDNAME_ _NEWNAME_
RD := rd /s/q
RC :=
else
SD := gcc -M
SE := sed
RM := rm -f
MD := mkdir -p
RN := mv _PATH__OLDNAME_ _NEWNAME_
RD := rm -rf
RC :=
endif

# Commands
IFEXIST := if [ -e "_FILE_" ]; then _COMMAND_; fi
IFNOTEXIST := if [ ! -e "_FILE_" ]; then _COMMAND_; fi
ifeq ($(OS),Windows_NT)
IFEXIST := if exist _FILE_ _COMMAND_
IFNOTEXIST := if not exist _FILE_ _COMMAND_
else
IFEXIST := if [ -e "_FILE_" ]; then _COMMAND_; fi
IFNOTEXIST := if [ ! -e "_FILE_" ]; then _COMMAND_; fi
endif

# Other OS dependent variables
# Work around to make sure only a single backslash is set
PATH_SEP := $(subst \\,/,/)
ifeq ($(OS),Windows_NT)
PATH_SEP := $(subst \\,\,\\)
else
PATH_SEP := $(subst \\,/,/)
endif

ifeq ($(PLATFORM),stm32App)

Expand Down Expand Up @@ -119,7 +138,11 @@ ifneq ($(PLATFORM),)
-D"NDEBUG" -DTARGET_STM32 \
$(foreach USRDEF,$(USRDEFS),-D"$(USRDEF)") \
$(foreach USRUNDEF,$(USRUNDEFS),-U"$(USRUNDEF)")
CCFLAGS = $(SDFLAGS) -mcpu=cortex-m3 -mthumb -o $(INTDIR)/$@
ifeq ($(OS),Windows_NT)
CCFLAGS = $(SDFLAGS) -mcpu=cortex-m3 -mthumb -o $(INTDIR)\$@
else
CCFLAGS = $(SDFLAGS) -mcpu=cortex-m3 -mthumb -o $(INTDIR)/$@
endif
CXXFLAGS := -std=gnu++0x
ifeq ($(TYPE),DLL)
LD := arm-none-eabi-g++
Expand All @@ -140,8 +163,13 @@ ifneq ($(PLATFORM),)
ifeq ($(TYPE),LIB)
LD := arm-none-eabi-ar
OUT_EXT := $(LIB_EXT)
ASFLAGS = -g -x assembler-with-cpp -c -mcpu=cortex-m3 -mthumb $(foreach USRDEF,$(USRDEFS),-D"$(USRDEF)") \
ifeq ($(OS),Windows_NT)
ASFLAGS = -g -x assembler-with-cpp -c -mcpu=cortex-m3 -mthumb $(foreach USRDEF,$(USRDEFS),-D"$(USRDEF)") \
$(foreach USRUNDEF,$(USRUNDEFS),-U"$(USRUNDEF)") -o $(INTDIR)\$@
else
ASFLAGS = -g -x assembler-with-cpp -c -mcpu=cortex-m3 -mthumb $(foreach USRDEF,$(USRDEFS),-D"$(USRDEF)") \
$(foreach USRUNDEF,$(USRUNDEFS),-U"$(USRUNDEF)") -o $(INTDIR)/$@
endif
LDFLAGS = crus $@
endif
endif
Expand Down Expand Up @@ -175,7 +203,11 @@ ifneq ($(PLATFORM),)
-D"NDEBUG" -DTARGET_STM32 \
$(foreach USRDEF,$(USRDEFS),-D"$(USRDEF)") \
$(foreach USRUNDEF,$(USRUNDEFS),-U"$(USRUNDEF)")
CCFLAGS = $(SDFLAGS) -mcpu=cortex-m3 -mthumb -o $(INTDIR)/$@
ifeq ($(OS),Windows_NT)
CCFLAGS = $(SDFLAGS) -mcpu=cortex-m3 -mthumb -o $(INTDIR)\$@
else
CCFLAGS = $(SDFLAGS) -mcpu=cortex-m3 -mthumb -o $(INTDIR)/$@
endif
CXXFLAGS := -std=gnu++0x
ifeq ($(TYPE),DLL)
LD := arm-none-eabi-g++
Expand All @@ -196,8 +228,13 @@ ifneq ($(PLATFORM),)
ifeq ($(TYPE),LIB)
LD := arm-none-eabi-ar
OUT_EXT := $(LIB_EXT)
ifeq ($(OS),Windows_NT)
ASFLAGS = -g -x assembler-with-cpp -c -mcpu=cortex-m3 -mthumb $(foreach USRDEF,$(USRDEFS),-D"$(USRDEF)") \
$(foreach USRUNDEF,$(USRUNDEFS),-U"$(USRUNDEF)") -o $(INTDIR)\$@
else
ASFLAGS = -g -x assembler-with-cpp -c -mcpu=cortex-m3 -mthumb $(foreach USRDEF,$(USRDEFS),-D"$(USRDEF)") \
$(foreach USRUNDEF,$(USRUNDEFS),-U"$(USRUNDEF)") -o $(INTDIR)/$@
endif
LDFLAGS = crus $@
endif
endif
Expand Down

0 comments on commit f96e01e

Please sign in to comment.