mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
19e4034ace
Conflicts: Makefile.modules core/kernel_init.c core/thread.c cpu/arm_common/arm_cpu.c cpu/arm_common/syscalls.c cpu/lpc_common/hwtimer_cpu.c cpu/lpc_common/iap.c sys/include/transceiver.h sys/net/sixlowpan/sixlowip.c sys/net/sixlowpan/sixlowmac.c sys/net/sixlowpan/sixlowmac.h sys/net/sixlowpan/sixlowpan.c sys/transceiver/Makefile sys/transceiver/transceiver.c
92 lines
2.4 KiB
Makefile
92 lines
2.4 KiB
Makefile
# set undefined variables
|
|
ifeq ($(strip $(RIOTCPU)),)
|
|
export RIOTCPU =$(RIOTBASE)/cpu
|
|
endif
|
|
|
|
ifeq ($(strip $(MCU)),)
|
|
MCU = $(CPU)
|
|
endif
|
|
|
|
# if you want to publish the board into the sources as an uppercase #define
|
|
BB = $(shell echo $(BOARD)|tr 'a-z' 'A-Z')
|
|
CFLAGS += -DBOARD=$(BB)
|
|
export CFLAGS
|
|
|
|
# mandatory includes!
|
|
include $(RIOTBOARD)/$(BOARD)/Makefile.include
|
|
include $(RIOTCPU)/Makefile.include
|
|
include $(RIOTBASE)/Makefile.modules
|
|
|
|
# your binaries to link
|
|
BASELIBS += $(RIOTBOARD)/$(BOARD)/bin/$(BOARD)_base.a
|
|
BASELIBS += $(PROJBINDIR)/${PROJECT}.a
|
|
|
|
PROJBINDIR =$(CURDIR)/bin
|
|
|
|
# clumsy way to enable building native on osx:
|
|
BUILDOSXNATIVE = 0
|
|
ifeq ($(CPU),native)
|
|
ifeq ($(shell uname -s),Darwin)
|
|
BUILDOSXNATIVE = 1
|
|
endif
|
|
endif
|
|
|
|
# backward compatability with glibc <= 2.17 for native
|
|
ifeq ($(CPU),native)
|
|
ifeq ($(shell uname -s),Linux)
|
|
ifeq ($(shell ldd --version | awk '/^ldd/{if ($$NF < 2.17) {print "yes"} else {print "no"} }'),yes)
|
|
LINKFLAGS += -lrt
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
## make script for your project. Build RIOT-base here!
|
|
all: $(PROJBINDIR)/$(PROJECT).a
|
|
@echo "Building project $(PROJECT) for $(BOARD) w/ MCU $(MCU)."
|
|
$(MAKE) -C $(RIOTBOARD)
|
|
$(MAKE) -C $(RIOTBASE)
|
|
@for i in $(EXTERNAL_MODULES) ; do $(MAKE) -C $$i ; done ;
|
|
ifeq ($(BUILDOSXNATIVE),1)
|
|
@$(LINK) $(UNDEF) -o $(PROJBINDIR)/$(PROJECT).elf $(BASELIBS) $(LINKFLAGS) -Wl,-no_pie
|
|
else
|
|
@$(LINK) $(UNDEF) -o $(PROJBINDIR)/$(PROJECT).elf -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=$(PROJBINDIR)/$(PROJECT).map $(LINKFLAGS)
|
|
@$(SIZE) $(PROJBINDIR)/$(PROJECT).elf
|
|
@$(OBJCOPY) -O ihex $(PROJBINDIR)/$(PROJECT).elf $(PROJBINDIR)/$(PROJECT).hex
|
|
endif
|
|
|
|
## your make rules
|
|
## Only basic example - modify it for larger projects!!
|
|
#$(PROJBINDIR)/$(PROJECT).a: $(PROJBINDIR)/$(PROJECT).o
|
|
# $(AR) -rc $(PROJBINDIR)/project.a $(PROJBINDIR)/$(PROJECT).o
|
|
|
|
# string array of all names of c files in dir
|
|
SRC = $(wildcard *.c)
|
|
|
|
# string array of all names replaced .c with .o
|
|
OBJ = $(SRC:%.c=${PROJBINDIR}/%.o)
|
|
|
|
${PROJBINDIR}/$(PROJECT).a: $(OBJ)
|
|
$(AR) -rc bin/$(PROJECT).a $(OBJ)
|
|
|
|
# pull in dependency info for *existing* .o files
|
|
-include $(OBJ:.o=.d)
|
|
|
|
${PROJBINDIR}/%.o: %.c
|
|
@echo; echo "Compiling.... $*.c"; echo
|
|
$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o bin/$*.o
|
|
|
|
clean:
|
|
$(MAKE) -C $(RIOTBOARD) clean
|
|
$(MAKE) -C $(RIOTBASE) clean
|
|
@for i in $(EXTERNAL_MODULES) ; do $(MAKE) -C $$i clean ; done ;
|
|
rm -f $(PROJBINDIR)/*
|
|
|
|
flash: all
|
|
$(FLASHER) $(FFLAGS)
|
|
|
|
term:
|
|
$(TERM) $(PORT)
|
|
|
|
doc:
|
|
make -BC $(RIOTBASE) doc
|