mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
build everything in the project directory
This commit is contained in:
parent
e6b354db5d
commit
1e665b49de
@ -17,16 +17,16 @@ CPUDEF = $(shell echo $(CPU)|tr 'a-z' 'A-Z')
|
||||
CFLAGS += -DBOARD=$(BB) -DCPU_$(CPUDEF)
|
||||
export CFLAGS
|
||||
|
||||
export BINDIR =$(CURDIR)/bin/
|
||||
|
||||
# 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
|
||||
BASELIBS += $(BINDIR)/$(BOARD)_base.a
|
||||
BASELIBS += $(BINDIR)/${PROJECT}.a
|
||||
|
||||
# clumsy way to enable building native on osx:
|
||||
BUILDOSXNATIVE = 0
|
||||
@ -48,46 +48,46 @@ endif
|
||||
.PHONY: all clean flash doc term
|
||||
|
||||
## make script for your project. Build RIOT-base here!
|
||||
all: $(PROJBINDIR)/$(PROJECT).a
|
||||
all: $(BINDIR)/$(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
|
||||
@$(LINK) $(UNDEF) -o $(BINDIR)/$(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) $(OFLAGS) $(PROJBINDIR)/$(PROJECT).elf $(PROJBINDIR)/$(PROJECT).hex
|
||||
@$(LINK) $(UNDEF) -o $(BINDIR)/$(PROJECT).elf -Wl,--start-group $(BASELIBS) -lm -Wl,--end-group -Wl,-Map=$(BINDIR)/$(PROJECT).map $(LINKFLAGS)
|
||||
@$(SIZE) $(BINDIR)/$(PROJECT).elf
|
||||
@$(OBJCOPY) $(OFLAGS) $(BINDIR)/$(PROJECT).elf $(BINDIR)/$(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
|
||||
#$(BINDIR)/$(PROJECT).a: $(BINDIR)/$(PROJECT).o
|
||||
# $(AR) -rc $(BINDIR)/project.a $(BINDIR)/$(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)
|
||||
OBJ = $(SRC:%.c=${BINDIR}/%.o)
|
||||
|
||||
$(PROJBINDIR)/$(PROJECT).a: $(OBJ)
|
||||
$(AR) -rc $(PROJBINDIR)/$(PROJECT).a $(OBJ)
|
||||
$(BINDIR)/$(PROJECT).a: $(OBJ)
|
||||
$(AR) -rc $(BINDIR)/$(PROJECT).a $(OBJ)
|
||||
|
||||
# pull in dependency info for *existing* .o files
|
||||
-include $(OBJ:.o=.d)
|
||||
|
||||
$(PROJBINDIR)/%.o: %.c $(PROJDEPS)
|
||||
$(BINDIR)/%.o: %.c $(PROJDEPS)
|
||||
@echo; echo "Compiling.... $*.c"; echo
|
||||
@test -d $(PROJBINDIR) || mkdir -p $(PROJBINDIR)
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(PROJBINDIR)/$*.o
|
||||
@test -d $(BINDIR) || mkdir -p $(BINDIR)
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)/$*.o
|
||||
|
||||
clean:
|
||||
"$(MAKE)" -C $(RIOTBOARD) clean
|
||||
"$(MAKE)" -C $(RIOTBASE) clean
|
||||
@for i in $(EXTERNAL_MODULES) ; do "$(MAKE)" -C $$i clean ; done ;
|
||||
rm -rf $(PROJBINDIR)
|
||||
rm -rf $(BINDIR)
|
||||
|
||||
flash: all
|
||||
$(FLASHER) $(FFLAGS)
|
||||
|
@ -1,5 +1,4 @@
|
||||
export MAKEBASE =$(RIOTBASE)
|
||||
export BINDIR =$(RIOTBASE)/bin/
|
||||
UNDEF += $(BINDIR)startup.o
|
||||
|
||||
USEMODULE += cpu core sys
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
export ARCH = avsextrem_base.a
|
||||
|
||||
@ -33,6 +32,6 @@ clean:
|
||||
"$(MAKE)" -C drivers clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
export ARCH = chronos_base.a
|
||||
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
@ -32,4 +31,4 @@ clean:
|
||||
$(MAKE) -C drivers clean
|
||||
rm -f $(OBJ) $(DEP)
|
||||
rm -f $(BINDIR)$(ARCH)
|
||||
-rmdir $(BINDIR)
|
||||
-rm -rf $(BINDIR)
|
||||
|
@ -15,7 +15,7 @@ export AS = $(PREFIX)as
|
||||
export LINK = $(PREFIX)gcc
|
||||
export SIZE = $(PREFIX)size
|
||||
export OBJCOPY = $(PREFIX)objcopy
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(RIOTBASE)/bin/startup.o
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(BINDIR)/startup.o
|
||||
export FLASHER = mspdebug
|
||||
export HEXFILE = bin/$(PROJECT).hex
|
||||
export USEMODULE += msp430_common
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
export ARCH = mbed_lpc1768_base.a
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -12,7 +12,7 @@ export AS = $(PREFIX)as
|
||||
export LINK = $(PREFIX)gcc
|
||||
export SIZE = $(PREFIX)size
|
||||
export OBJCOPY = $(PREFIX)objcopy
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(RIOTBASE)/bin/startup.o
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(BINDIR)/startup.o
|
||||
TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm.py
|
||||
export HEXFILE = bin/$(PROJECT).hex
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
export ARCH = msb-430_base.a
|
||||
|
||||
@ -30,5 +29,5 @@ clean:
|
||||
$(MAKE) -C ../msb-430-common clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
export ARCH = msb-430h_base.a
|
||||
|
||||
@ -31,7 +30,7 @@ clean:
|
||||
$(MAKE) -C ../msb-430-common clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -20,7 +20,7 @@ ifeq ($(strip $(PORT)),)
|
||||
export PORT = /dev/ttyUSB0
|
||||
endif
|
||||
export HEXFILE = bin/$(PROJECT).hex
|
||||
export FFLAGS = $(PORT) $(PROJBINDIR)/$(PROJECT).hex
|
||||
export FFLAGS = $(PORT) $(BINDIR)/$(PROJECT).hex
|
||||
include $(RIOTBOARD)/msba2-common/Makefile.dep
|
||||
|
||||
export INCLUDES += -I$(RIOTCPU)/lpc2387/include
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
export ARCH = msba2_base.a
|
||||
|
||||
@ -31,7 +30,7 @@ clean:
|
||||
$(MAKE) -C ../msba2-common clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
export ARCH = native_base.a
|
||||
@ -27,5 +26,5 @@ $(BINDIR)%.o: %.c
|
||||
clean:
|
||||
${MAKE} -C drivers clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
-rmdir -p $(BINDIR)
|
||||
-rm -rf -p $(BINDIR)
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(BINDIR)native-led.o
|
||||
ifneq (,$(findstring ltc4150,$(USEMODULE)))
|
||||
OBJ += $(BINDIR)native-ltc4150.o
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
export ARCH = $(BOARD)_base.a
|
||||
@ -32,6 +31,6 @@ clean:
|
||||
"$(MAKE)" -C drivers clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
export ARCH = telosb_base.a
|
||||
|
||||
@ -30,5 +29,5 @@ $(BINDIR)%.o: %.c
|
||||
clean:
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
@ -13,7 +13,7 @@ export AS = $(PREFIX)as
|
||||
export LINK = $(PREFIX)gcc
|
||||
export SIZE = $(PREFIX)size
|
||||
export OBJCOPY = $(PREFIX)objcopy
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(RIOTBASE)/bin/startup.o
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(BINDIR)/startup.o
|
||||
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm.py
|
||||
export FLASHER = goodfet.bsl
|
||||
ifeq ($(strip $(PORT)),)
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
|
||||
|
@ -12,7 +12,7 @@ export AS = $(PREFIX)as
|
||||
export LINK = $(PREFIX)gcc
|
||||
export SIZE = $(PREFIX)size
|
||||
export OBJCOPY = $(PREFIX)objcopy
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(RIOTBASE)/bin/startup.o
|
||||
export LINKFLAGS = -mmcu=$(MCU) -lgcc $(BINDIR)/startup.o
|
||||
export FLASHER = mspdebug
|
||||
ifeq ($(strip $(PORT)),)
|
||||
export PORT = /dev/ttyUSB0
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
export ARCH = wsn430-v1_3b_base.a
|
||||
|
||||
@ -32,5 +31,5 @@ clean:
|
||||
$(MAKE) -C ../wsn430-common clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
fi
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
@ -1,5 +1,4 @@
|
||||
SRC = $(wildcard *.c)
|
||||
BINDIR = bin/
|
||||
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
|
||||
export ARCH = wsn430-v1_4_base.a
|
||||
|
||||
@ -31,5 +30,5 @@ clean:
|
||||
$(MAKE) -C ../wsn430-common clean
|
||||
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
|
||||
@if [ -d $(BINDIR) ] ; \
|
||||
then rmdir $(BINDIR) ; \
|
||||
then rm -rf $(BINDIR) ; \
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user