Skip to content

Commit

Permalink
Merge pull request RIOT-OS#4 from miri64/newlib/enh/newlib_gnu_source
Browse files Browse the repository at this point in the history
newlib: use RIOT dependency system for _GNU_SOURCE instead
  • Loading branch information
kYc0o authored Oct 24, 2017
2 parents 3bbda70 + c80965f commit 4b6160e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ OLD_USEPKG := $(sort $(USEPKG))
# pull dependencies from drivers
include $(RIOTBASE)/drivers/Makefile.dep

ifneq (,$(filter cbor_ctime,$(USEMODULE)))
ifneq (,$(filter newlib,$(USEMODULE)))
USEMODULE += newlib_gnu_source
endif
endif

ifneq (,$(filter csma_sender,$(USEMODULE)))
USEMODULE += random
USEMODULE += xtimer
Expand Down Expand Up @@ -381,6 +387,10 @@ ifneq (,$(filter od,$(USEMODULE)))
USEMODULE += fmt
endif

ifneq (,$(filter newlib_gnu_source,$(USEMODULE)))
USEMODULE += newlib
endif

ifneq (,$(filter newlib_nano,$(USEMODULE)))
USEMODULE += newlib
endif
Expand Down
4 changes: 4 additions & 0 deletions makefiles/libc/newlib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ ifneq (,$(filter newlib_nano,$(USEMODULE)))
endif
endif

ifneq (,$(filter newlib_gnu_source,$(USEMODULE)))
CFLAGS += -D_GNU_SOURCE=1
endif

ifeq (1,$(USE_NEWLIB_NANO))
export LINKFLAGS += -specs=nano.specs
endif
Expand Down
1 change: 1 addition & 0 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ PSEUDOMODULES += netstats_l2
PSEUDOMODULES += netstats_ipv6
PSEUDOMODULES += netstats_rpl
PSEUDOMODULES += newlib
PSEUDOMODULES += newlib_gnu_source
PSEUDOMODULES += newlib_nano
PSEUDOMODULES += openthread
PSEUDOMODULES += pktqueue
Expand Down
5 changes: 0 additions & 5 deletions sys/cbor/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
MODULE = cbor

ifneq (,$(filter cbor_ctime,$(USEMODULE)))
# Some toolchains need to set this for strptime, specially on OSX
CFLAGS += -D_GNU_SOURCE=1
endif

ifneq ($(shell uname -s),Darwin)
CFLAGS += -D_XOPEN_SOURCE=600
endif
Expand Down

0 comments on commit 4b6160e

Please sign in to comment.