Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newlib: use RIOT dependency system for _GNU_SOURCE instead #4

Merged
merged 1 commit into from
Oct 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this ifneq newlib here ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because on e.g. native we don't need it (and it actually leads to errors)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather see the native non native special handling into newlib.mk.
In Makefile.dep we say that cbor_time needs to be able to print time. And behind the scene, make it work for every case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But native doesn't even use newlib as do msp430 or AVR-based platforms. Handling the absence of a module as a special case in a module seems non-sensical to me.

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