Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Conversation

@jacksonbenete
Copy link

I hope you don't mind the pull request.
This will only make it easier for compiling sam on macOS.

People on macOS don't have to change config.mk, as we'll be adding the dependencies automatically.
Do you think this is a good idea?

@jacksonbenete
Copy link
Author

I'm detecting Darwin but not BSD though, since I don't have the various versions of BSD to test if the changes are still needed for compilation.
I removed the BSD comment, maybe we should keep it.

@jacksonbenete
Copy link
Author

This will also address #120 .

On line 18 I've detected the system version:

OSVERSION := $(shell sw_vers | awk '($$1 = /ProductVersion:/){ ($$2 < 10.7) ? source = "-D_ANSI_SOURCE" : source = "-D_DARWIN_C_SOURCE"; print source }')
STANDARDS+=$(OSVERSION)

This is a bit cryptic, alternatively we can get more verbose:

OSVERSION_NEED_ANSI := $(shell sw_vers | awk '($$1 = /ProductVersion:/){ ($$2 < 10.7) ? ansi = 1 : ansi = 0; print ansi }')        

ifeq ($(OSVERSION_NEED_ANSI), 1) 
  STANDARDS+=-D_ANSI_SOURCE
else
  STANDARDS+=-D_DARWIN_C_SOURCE                                                                                          
endif

@jacksonbenete jacksonbenete mentioned this pull request Feb 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant