1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

moved native board drivers into separate directory

split up drivers to avoid building unnecessary files
This commit is contained in:
Oliver Hahm 2013-06-12 16:23:34 +02:00
parent 0ac14625f3
commit c31648e2e4
6 changed files with 39 additions and 6 deletions

View File

@ -2,14 +2,16 @@ SRC = $(wildcard *.c)
BINDIR = bin/
OBJ = $(SRC:%.c=$(BINDIR)%.o)## defines
DEP = $(SRC:%.c=$(BINDIR)%.d)
export ARCH = native_base.a
INCLUDES += -I$(RIOTBASE)/cpu/native/include/
INCLUDES += -I$(RIOTBOARD)/native/include/
all: $(BINDIR)native_base.a
all: $(BINDIR)$(ARCH)
$(MAKE) -C drivers
$(BINDIR)native_base.a: $(OBJ)
$(AR) rcs $(BINDIR)native_base.a $(OBJ)
$(BINDIR)$(ARCH): $(OBJ)
$(AR) rcs $(BINDIR)$(ARCH) $(OBJ)
# pull in dependency info for *existing* .o files
-include $(OBJ:.o=.d)
@ -23,6 +25,7 @@ $(BINDIR)%.o: %.c
# remove compilation products
clean:
rm -f $(BINDIR)native_base.a $(OBJ) $(DEP)
${MAKE} -C drivers clean
rm -f $(BINDIR)$(ARCH) $(OBJ) $(DEP)
-rmdir -p $(BINDIR)

View File

@ -5,7 +5,7 @@ export CPU = native
export PREFIX =
#export CC = @$(PREFIX)gcc
export AR = @$(PREFIX)ar
export CFLAGS = -std=gnu99 -Wall -m32
export CFLAGS += -std=gnu99 -Wall -m32
export ASFLAGS =
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
@ -14,7 +14,7 @@ export OBJCOPY = $(PREFIX)objcopy
FLASHER = lpc2k_pgm
TERM = pyterm.py
LINKFLAGS = -m32
LINKFLAGS = -m32 -gc
ifeq ($(strip $(PORT)),)
export PORT = /dev/ttyUSB0

30
native/drivers/Makefile Normal file
View File

@ -0,0 +1,30 @@
SRC = $(wildcard *.c)
BINDIR = $(RIOTBOARD)/$(BOARD)/bin/
OBJ = $(BINDIR)native-led.o
ifneq (,$(findstring ltc4150,$(USEMODULE)))
OBJ += $(BINDIR)native-ltc4150.o
endif
ifneq (,$(findstring uart0,$(USEMODULE)))
OBJ += $(BINDIR)native-uart0.o
endif
DEP = $(SRC:%.c=$(BINDIR)%.d)
INCLUDES += -I$(RIOTBOARD)/native/include/
$(BINDIR)native_drivers.a: $(OBJ)
@$(AR) rcs $(BINDIR)${ARCH} $(OBJ)
# pull in dependency info for *existing* .o files
-include $(OBJ:.o=.d)
# compile and generate dependency info
$(BINDIR)%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
@$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
# remove compilation products
clean:
rm -f $(OBJ) $(DEP)