Skip to content

Commit

Permalink
moved native board drivers into separate directory
Browse files Browse the repository at this point in the history
split up drivers to avoid building unnecessary files
  • Loading branch information
OlegHahm committed Jul 24, 2013
1 parent eda5afc commit c6061b8
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 6 deletions.
11 changes: 7 additions & 4 deletions native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

4 changes: 2 additions & 2 deletions native/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
30 changes: 30 additions & 0 deletions native/drivers/Makefile
Original file line number Diff line number Diff line change
@@ -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)

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c6061b8

Please sign in to comment.