@@ -110,50 +110,42 @@ MK_LDFLAGS =
110
110
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
111
111
# posix_memalign came in POSIX.1-2001 / SUSv3
112
112
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
113
- MK_CFLAGS += -D_XOPEN_SOURCE=600
114
- MK_CXXFLAGS += -D_XOPEN_SOURCE=600
113
+ MK_CPPFLAGS += -D_XOPEN_SOURCE=600
115
114
116
115
# Somehow in OpenBSD whenever POSIX conformance is specified
117
116
# some string functions rely on locale_t availability,
118
117
# which was introduced in POSIX.1-2008, forcing us to go higher
119
118
ifeq ($(UNAME_S ) ,OpenBSD)
120
- MK_CFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
121
- MK_CXXFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
119
+ MK_CPPFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
122
120
endif
123
121
124
122
# Data types, macros and functions related to controlling CPU affinity and
125
123
# some memory allocation are available on Linux through GNU extensions in libc
126
124
ifeq ($(UNAME_S ) ,Linux)
127
- MK_CFLAGS += -D_GNU_SOURCE
128
- MK_CXXFLAGS += -D_GNU_SOURCE
125
+ MK_CPPFLAGS += -D_GNU_SOURCE
129
126
endif
130
127
131
128
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
132
129
# and on macOS its availability depends on enabling Darwin extensions
133
130
# similarly on DragonFly, enabling BSD extensions is necessary
134
131
ifeq ($(UNAME_S ) ,Darwin)
135
- MK_CFLAGS += -D_DARWIN_C_SOURCE
136
- MK_CXXFLAGS += -D_DARWIN_C_SOURCE
132
+ MK_CPPFLAGS += -D_DARWIN_C_SOURCE
137
133
endif
138
134
ifeq ($(UNAME_S ) ,DragonFly)
139
- MK_CFLAGS += -D__BSD_VISIBLE
140
- MK_CXXFLAGS += -D__BSD_VISIBLE
135
+ MK_CPPFLAGS += -D__BSD_VISIBLE
141
136
endif
142
137
143
138
# alloca is a non-standard interface that is not visible on BSDs when
144
139
# POSIX conformance is specified, but not all of them provide a clean way
145
140
# to enable it in such cases
146
141
ifeq ($(UNAME_S ) ,FreeBSD)
147
- MK_CFLAGS += -D__BSD_VISIBLE
148
- MK_CXXFLAGS += -D__BSD_VISIBLE
142
+ MK_CPPFLAGS += -D__BSD_VISIBLE
149
143
endif
150
144
ifeq ($(UNAME_S ) ,NetBSD)
151
- MK_CFLAGS += -D_NETBSD_SOURCE
152
- MK_CXXFLAGS += -D_NETBSD_SOURCE
145
+ MK_CPPFLAGS += -D_NETBSD_SOURCE
153
146
endif
154
147
ifeq ($(UNAME_S ) ,OpenBSD)
155
- MK_CFLAGS += -D_BSD_SOURCE
156
- MK_CXXFLAGS += -D_BSD_SOURCE
148
+ MK_CPPFLAGS += -D_BSD_SOURCE
157
149
endif
158
150
159
151
ifdef LLAMA_DEBUG
@@ -182,7 +174,7 @@ MK_CFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wdouble-promotion -Wshadow
182
174
-Wmissing-prototypes -Werror=implicit-int -Wno-unused-function
183
175
MK_CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wno-multichar
184
176
185
- ifeq '' '$(findstring clang++ ,$(CXX ) ) '
177
+ ifeq '' '$(findstring clang,$(shell $( CXX ) --version ) ) '
186
178
# g++ only
187
179
MK_CXXFLAGS += -Wno-format-truncation -Wno-array-bounds
188
180
endif
0 commit comments