1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

make: sort wildcard sources to make binaries identical on all platforms

Thanks to Amedee for finding the cause of the difference and CorvusCorax
for participating in the discussion.
This commit is contained in:
Oleg Semyonov 2013-04-19 20:43:31 +02:00
parent efeb7c4890
commit 491e89b165
9 changed files with 20 additions and 20 deletions

View File

@ -11,7 +11,7 @@ ifeq ($(USE_DSP_LIB), YES)
CMSIS_DSPLIB := $(CMSIS2_DIR)DSP_Lib/Source CMSIS_DSPLIB := $(CMSIS2_DIR)DSP_Lib/Source
# Compile all files into output directory # Compile all files into output directory
DSPLIB_SRC := $(wildcard $(CMSIS_DSPLIB)/*/*.c) DSPLIB_SRC := $(sort $(wildcard $(CMSIS_DSPLIB)/*/*.c))
DSPLIB_SRCBASE := $(notdir $(basename $(DSPLIB_SRC))) DSPLIB_SRCBASE := $(notdir $(basename $(DSPLIB_SRC)))
$(foreach src, $(DSPLIB_SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src)))) $(foreach src, $(DSPLIB_SRC), $(eval $(call COMPILE_C_TEMPLATE, $(src))))

View File

@ -6,5 +6,5 @@
# #
FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source
SRC += $(wildcard $(FREERTOS_DIR)/*.c) SRC += $(sort $(wildcard $(FREERTOS_DIR)/*.c))
EXTRAINCDIRS += $(FREERTOS_DIR)/include EXTRAINCDIRS += $(FREERTOS_DIR)/include

View File

@ -3,5 +3,5 @@
# #
DOSFS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) DOSFS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
SRC += $(wildcard $(DOSFS_DIR)*.c) SRC += $(sort $(wildcard $(DOSFS_DIR)*.c))
EXTRAINCDIRS += $(DOSFS_DIR) EXTRAINCDIRS += $(DOSFS_DIR)

View File

@ -3,5 +3,5 @@
# #
MSHEAP_DIR := $(dir $(lastword $(MAKEFILE_LIST))) MSHEAP_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
SRC += $(wildcard $(MSHEAP_DIR)*.c) SRC += $(sort $(wildcard $(MSHEAP_DIR)*.c))
EXTRAINCDIRS += $(MSHEAP_DIR) EXTRAINCDIRS += $(MSHEAP_DIR)

View File

@ -18,7 +18,7 @@ ARCHFLAGS += -mcpu=cortex-m3 --specs=nano.specs
ASRC += $(PIOS_DEVLIB)startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S ASRC += $(PIOS_DEVLIB)startup_stm32f10x_$(MODEL)$(MODEL_SUFFIX).S
# PIOS device library source and includes # PIOS device library source and includes
SRC += $(wildcard $(PIOS_DEVLIB)*.c) SRC += $(sort $(wildcard $(PIOS_DEVLIB)*.c))
# CMSIS for the F1 # CMSIS for the F1
include $(PIOS)/Common/Libraries/CMSIS2/library.mk include $(PIOS)/Common/Libraries/CMSIS2/library.mk
@ -29,12 +29,12 @@ EXTRAINCDIRS += $(CMSIS_DIR)
# ST Peripheral library # ST Peripheral library
PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F10x_StdPeriph_Driver PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F10x_StdPeriph_Driver
SRC += $(wildcard $(PERIPHLIB)/src/*.c) SRC += $(sort $(wildcard $(PERIPHLIB)/src/*.c))
EXTRAINCDIRS += $(PERIPHLIB)/inc EXTRAINCDIRS += $(PERIPHLIB)/inc
# ST USB Device library # ST USB Device library
USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB-FS-Device_Driver USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB-FS-Device_Driver
SRC += $(wildcard $(USBDEVLIB)/src/*.c) SRC += $(sort $(wildcard $(USBDEVLIB)/src/*.c))
EXTRAINCDIRS += $(USBDEVLIB)/inc EXTRAINCDIRS += $(USBDEVLIB)/inc
# #
@ -45,7 +45,7 @@ EXTRAINCDIRS += $(USBDEVLIB)/inc
# #
ifneq ($(FREERTOS_DIR),) ifneq ($(FREERTOS_DIR),)
FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source
SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3/*.c) SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3/*.c))
SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/heap_1.c) SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/heap_1.c))
EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3 EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM3
endif endif

View File

@ -20,18 +20,18 @@ CDEFS += -DARM_MATH_CM4 -D__FPU_PRESENT=1
ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard ARCHFLAGS += -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
# PIOS device library source and includes # PIOS device library source and includes
SRC += $(wildcard $(PIOS_DEVLIB)*.c) SRC += $(sort $(wildcard $(PIOS_DEVLIB)*.c))
EXTRAINCDIRS += $(PIOS_DEVLIB)inc EXTRAINCDIRS += $(PIOS_DEVLIB)inc
# CMSIS for the F4 # CMSIS for the F4
include $(PIOSCOMMON)/Libraries/CMSIS2/library.mk include $(PIOSCOMMON)/Libraries/CMSIS2/library.mk
CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)Libraries/CMSIS2/Device/ST/STM32F4xx CMSIS2_DEVICEDIR := $(PIOS_DEVLIB)Libraries/CMSIS2/Device/ST/STM32F4xx
SRC += $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c) SRC += $(sort $(wildcard $(CMSIS2_DEVICEDIR)/Source/$(BOARD_NAME)/*.c))
EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include EXTRAINCDIRS += $(CMSIS2_DEVICEDIR)/Include
# ST Peripheral library # ST Peripheral library
PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F4xx_StdPeriph_Driver PERIPHLIB = $(PIOS_DEVLIB)Libraries/STM32F4xx_StdPeriph_Driver
SRC += $(wildcard $(PERIPHLIB)/src/*.c) SRC += $(sort $(wildcard $(PERIPHLIB)/src/*.c))
EXTRAINCDIRS += $(PERIPHLIB)/inc EXTRAINCDIRS += $(PERIPHLIB)/inc
# ST USB OTG library # ST USB OTG library
@ -42,7 +42,7 @@ EXTRAINCDIRS += $(USBOTGLIB)/inc
# ST USB Device library # ST USB Device library
USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB_Device_Library USBDEVLIB = $(PIOS_DEVLIB)Libraries/STM32_USB_Device_Library
SRC += $(wildcard $(USBDEVLIB)/Core/src/*.c) SRC += $(sort $(wildcard $(USBDEVLIB)/Core/src/*.c))
EXTRAINCDIRS += $(USBDEVLIB)/Core/inc EXTRAINCDIRS += $(USBDEVLIB)/Core/inc
# #
@ -53,7 +53,7 @@ EXTRAINCDIRS += $(USBDEVLIB)/Core/inc
# #
ifneq ($(FREERTOS_DIR),) ifneq ($(FREERTOS_DIR),)
FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source FREERTOS_PORTDIR := $(PIOS_DEVLIB)Libraries/FreeRTOS/Source
SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c) SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F/*.c))
EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/ARM_CM4F
include $(PIOSCOMMON)/Libraries/msheap/library.mk include $(PIOSCOMMON)/Libraries/msheap/library.mk
endif endif

View File

@ -6,5 +6,5 @@
# #
FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source FREERTOS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))/Source
SRC += $(wildcard $(FREERTOS_DIR)/*.c) SRC += $(sort $(wildcard $(FREERTOS_DIR)/*.c))
EXTRAINCDIRS += $(FREERTOS_DIR)/include EXTRAINCDIRS += $(FREERTOS_DIR)/include

View File

@ -27,7 +27,7 @@ ARCHFLAGS += -DARCH_POSIX
# #
# PIOS device library source and includes # PIOS device library source and includes
# #
SRC += $(wildcard $(PIOS_DEVLIB)*.c) SRC += $(sort $(wildcard $(PIOS_DEVLIB)*.c))
EXTRAINCDIRS += $(PIOS_DEVLIB)/inc EXTRAINCDIRS += $(PIOS_DEVLIB)/inc
# #
@ -68,8 +68,8 @@ EXTRAINCDIRS += $(PIOS_DEVLIB)/inc
# #
ifneq ($(FREERTOS_DIR),) ifneq ($(FREERTOS_DIR),)
FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source FREERTOS_PORTDIR := $(PIOS_DEVLIB)/Libraries/FreeRTOS/Source
SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/Posix/*.c) SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/GCC/Posix/*.c))
SRC += $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/*.c) SRC += $(sort $(wildcard $(FREERTOS_PORTDIR)/portable/MemMang/*.c))
EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/Posix EXTRAINCDIRS += $(FREERTOS_PORTDIR)/portable/GCC/Posix
endif endif

View File

@ -101,8 +101,8 @@ SRC += $(MATHLIB)/sin_lookup.c
SRC += $(MATHLIB)/pid.c SRC += $(MATHLIB)/pid.c
## Modules ## Modules
SRC += $(foreach mod, $(MODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) SRC += $(foreach mod, $(MODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c)))
SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c)) SRC += $(foreach mod, $(OPTMODULES), $(sort $(wildcard $(OPMODULEDIR)/$(mod)/*.c)))
# Declare all non-optional modules as built-in to force inclusion. # Declare all non-optional modules as built-in to force inclusion.
# Built-in modules are always enabled and cannot be disabled. # Built-in modules are always enabled and cannot be disabled.