Skip to content

Commit

Permalink
Merge pull request #804 from LudwigOrtmann/native_include_separation
Browse files Browse the repository at this point in the history
native/make: Don't use INCLUDES for building any native at all.
  • Loading branch information
miri64 committed Mar 3, 2014
2 parents 8760ea8 + 2cd3f04 commit 49b1f44
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 11 deletions.
6 changes: 6 additions & 0 deletions boards/native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ all: $(BINDIR)$(MODULE).a

include $(RIOTBASE)/Makefile.base

$(BINDIR)%.o: %.c
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -c $*.c -o $(BINDIR)$*.o
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d


clean::
@for i in $(DIRS) ; do "$(MAKE)" -C $$i clean ; done ;
9 changes: 7 additions & 2 deletions boards/native/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
export NATIVEINCLUDES = -I$(RIOTBOARD)/$(BOARD)/include/
export NATIVEINCLUDES += -I$(RIOTBASE)/core/include/
export NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/

export CPU = native
export ELF = $(BINDIR)$(PROJECT).elf

Expand All @@ -23,7 +26,9 @@ export ASFLAGS =
export DEBUGGER_FLAGS = $(ELF)
export VALGRIND_FLAGS ?= --track-origins=yes
all-valgrind: export CFLAGS += -DHAVE_VALGRIND_H -g
all-valgrind: export INCLUDES += $(shell pkg-config valgrind --cflags)
all-valgrind: export NATIVEINCLUDES += $(shell pkg-config valgrind --cflags)

export INCLUDES += $(NATIVEINCLUDES)

# backward compatability with glibc <= 2.17 for native
ifeq ($(CPU),native)
Expand Down
5 changes: 5 additions & 0 deletions boards/native/drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do "$(MAKE)" -C $$i ; done ;

include $(RIOTBASE)/Makefile.base

$(BINDIR)%.o: %.c
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -c $*.c -o $(BINDIR)$*.o
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
6 changes: 2 additions & 4 deletions cpu/native/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
MODULE = cpu

EXCLUDES := -I$(RIOTBASE)/sys/posix/%

DIRS =
ifneq (,$(filter rtc,$(USEMODULE)))
DIRS += rtc
Expand All @@ -16,8 +14,8 @@ all: $(BINDIR)$(MODULE).a
include $(RIOTBASE)/Makefile.base

$(BINDIR)%.o: %.c
$(AD)$(CC) $(CFLAGS) $(filter-out $(EXCLUDES),$(INCLUDES)) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
@$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -c $*.c -o $(BINDIR)$*.o
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d


Expand Down
2 changes: 1 addition & 1 deletion cpu/native/Makefile.include
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export INCLUDES += -I$(RIOTCPU)/native/include
export NATIVEINCLUDES += -I$(RIOTCPU)/native/include -I$(RIOTBASE)/sys/include
6 changes: 2 additions & 4 deletions cpu/native/net/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
EXCLUDES := -I$(RIOTBASE)/sys/posix/%

MODULE = nativenet

include $(MAKEBASE)/Makefile.base

$(BINDIR)%.o: %.c
$(AD)$(CC) $(CFLAGS) $(filter-out $(EXCLUDES),$(INCLUDES)) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
@$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -c $*.c -o $(BINDIR)$*.o
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
5 changes: 5 additions & 0 deletions cpu/native/rtc/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
MODULE =rtc

include $(MAKEBASE)/Makefile.base

$(BINDIR)%.o: %.c
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -c $*.c -o $(BINDIR)$*.o
$(AD)$(CC) $(CFLAGS) $(NATIVEINCLUDES) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d

0 comments on commit 49b1f44

Please sign in to comment.