Lines Matching +full:macos +full:- +full:llvm +full:- +full:gcc +full:- +full:4
1 # honggfuzz - Makefile
2 # -----------------------------------------
6 # Copyright 2010-2015 by Google Inc. All Rights Reserved.
12 # http://www.apache.org/licenses/LICENSE-2.0
24 CC ?= gcc
27 HFUZZ_CC_BIN := hfuzz_cc/hfuzz-cc
28 HFUZZ_CC_SRCS := hfuzz_cc/hfuzz-cc.c
29 COMMON_CFLAGS := -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I.
30 COMMON_LDFLAGS := -lm libhfcommon/libhfcommon.a
32 CFLAGS ?= -O3 -mtune=native
34 LIBS_CFLAGS ?= -fPIC -fno-stack-protector
37 OS ?= $(shell uname -s)
38 MARCH ?= $(shell uname -m)
39 KERNEL ?= $(shell uname -r)
44 ARCH_CFLAGS := -std=c11 -I/usr/local/include \
45 -Wextra -Wno-override-init \
46 -funroll-loops \
47 -D_FILE_OFFSET_BITS=64
48 ARCH_LDFLAGS := -L/usr/local/include \
49 -pthread -lunwind-ptrace -lunwind-generic -lbfd -lopcodes -lrt -ldl
51 LIBS_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
54 WARN_LIBRARY += binutils-devel
56 ifeq ("$(wildcard /usr/include/libunwind-ptrace.h)","")
57 WARN_LIBRARY += libunwind-devel/libunwind8-devel
59 ifeq ("$(wildcard /usr/local/include/intel-pt.h)","/usr/local/include/intel-pt.h")
60 ARCH_CFLAGS += -D_HF_LINUX_INTEL_PT_LIB
61 ARCH_CFLAGS += -I/usr/local/include
62 ARCH_LDFLAGS += -L/usr/local/lib -lipt -Wl,--rpath=/usr/local/lib
64 ifeq ("$(wildcard /usr/include/intel-pt.h)","/usr/include/intel-pt.h")
65 ARCH_CFLAGS += -D_HF_LINUX_INTEL_PT_LIB
66 ARCH_LDFLAGS += -lipt
69 $(info --------------------------------------------------------)
73 $(info --------------------------------------------------------)
79 # MacOS-X grep seem to use colors unconditionally
80 GREP_COLOR = --color=never
84 OS_VERSION := $(shell sw_vers -productVersion)
105 OSX_SDK_VERSION := $(shell xcrun --show-sdk-version)
107 SDK_V := $(shell xcrun --sdk $(SDK_NAME) --show-sdk-path 2>/dev/null)
109 SDK := $(shell xcrun --sdk $(SDK_NAME) --show-sdk-path 2>/dev/null)
111 CC := $(shell xcrun --sdk $(SDK_NAME) --find cc)
112 LD := $(shell xcrun --sdk $(SDK_NAME) --find cc)
113 ARCH_CFLAGS := -arch x86_64 -std=c99 -isysroot $(SDK) \
114 -x objective-c -pedantic -fblocks \
115 -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized \
116 -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator \
117 -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes \
118 -Wno-embedded-directive
119 …ARCH_LDFLAGS := -F/System/Library/PrivateFrameworks -framework CoreSymbolication -framework IOKit \
120 … -F$(SDK_V)/System/Library/Frameworks -F$(SDK_V)/System/Library/PrivateFrameworks \
121 -F$(SDK)/System/Library/Frameworks \
122 -framework Foundation -framework ApplicationServices -framework Symbolication \
123 … -framework CoreServices -framework CrashReporterSupport -framework CoreFoundation \
124 -framework CommerceKit $(CRASH_REPORT)
126 XCODE_VER := $(shell xcodebuild -version | grep $(GREP_COLOR) "^Xcode" | cut -d " " -f2)
128 ARCH_LDFLAGS += -F/Applications/Xcode.app/Contents/SharedFrameworks \
129 -framework CoreSymbolicationDT \
130 -Wl,-rpath,/Applications/Xcode.app/Contents/SharedFrameworks
133 …MIG_RET := $(shell mig -header mac/mach_exc.h -user mac/mach_excUser.c -sheader mac/mach_excServer…
134 … -server mac/mach_excServer.c $(SDK)/usr/include/mach/mach_exc.defs &>/dev/null; echo $$?)
144 ARCH_CFLAGS := -std=c11 -I/usr/local/include -I/usr/pkg/include \
145 -Wextra -Wno-override-init \
146 -funroll-loops -D_KERNTYPES
147 ARCH_LDFLAGS := -L/usr/local/lib -L/usr/pkg/lib \
148 -pthread -lcapstone -lrt \
149 -Wl,--rpath=/usr/pkg/lib
156 ARCH_CFLAGS := -std=c11 -I/usr/local/include \
157 -Wextra -Wno-initializer-overrides -Wno-override-init \
158 -Wno-unknown-warning-option -Wno-unknown-pragmas \
159 -funroll-loops
160 ARCH_LDFLAGS := -pthread -L/usr/local/lib
165 COMPILER = $(shell $(CC) -v 2>&1 | \
166 grep $(GREP_COLOR) -oE '((gcc|clang) version|LLVM version.*clang)' | \
167 grep $(GREP_COLOR) -oE '(clang|gcc)' | head -n1)
169 ARCH_CFLAGS += -Wno-initializer-overrides -Wno-unknown-warning-option
170 ARCH_CFLAGS += -Wno-gnu-empty-initializer -Wno-format-pedantic
171 ARCH_CFLAGS += -Wno-gnu-statement-expression
172 CFLAGS_BLOCKS = -fblocks
175 ARCH_LDFLAGS += -lBlocksRuntime
196 CFLAGS += $(COMMON_CFLAGS) $(ARCH_CFLAGS) -D_HF_ARCH_${ARCH}
200 CFLAGS += -g -ggdb
201 LDFLAGS += -g -ggdb
205 ANDROID_API ?= android-26
208 ANDROID_APP_ABI ?= armeabi-v7a
216 # By default ndk-build cleans all project files to ensure that no semi-completed
218 # purposed to be used with android-all rule where we want recursive invocations
227 ifeq ($(ANDROID_APP_ABI),$(filter $(ANDROID_APP_ABI),armeabi armeabi-v7a))
228 ANDROID_NDK_TOOLCHAIN ?= arm-linux-androideabi-clang
231 ANDROID_NDK_TOOLCHAIN ?= x86-clang
233 else ifeq ($(ANDROID_APP_ABI),$(filter $(ANDROID_APP_ABI),arm64-v8a))
234 ANDROID_NDK_TOOLCHAIN ?= aarch64-linux-android-clang
237 ANDROID_NDK_TOOLCHAIN ?= x86_64-clang
244 ifeq ($(ANDROID_APP_ABI),$(filter $(ANDROID_APP_ABI),armeabi armeabi-v7a))
245 ANDROID_NDK_TOOLCHAIN ?= arm-linux-androideabi-4.9
248 ANDROID_NDK_TOOLCHAIN ?= x86-4.9
250 else ifeq ($(ANDROID_APP_ABI),$(filter $(ANDROID_APP_ABI),arm64-v8a))
251 ANDROID_NDK_TOOLCHAIN ?= aarch64-linux-android-4.9
254 ANDROID_NDK_TOOLCHAIN ?= x86_64-4.9
262 DIRS := . $(shell find $(SUBDIR_ROOTS) -type d)
278 $(CC) -c $(CFLAGS) $(CFLAGS_BLOCKS) -o $@ $<
281 $(CC) -fPIC -shared $(CFLAGS) -o $@ $<
284 $(CC) -fPIC -shared $(CFLAGS) -o $@ $<
287 $(LD) -o $(BIN) $(OBJS) $(LDFLAGS)
290 $(LD) -o $@ $(HFUZZ_CC_SRCS) $(LDFLAGS) $(CFLAGS) $(CFLAGS_BLOCKS) -D_HFUZZ_INC_PATH=$(HFUZZ_INC)
293 $(CC) -c $(CFLAGS) $(LIBS_CFLAGS) -o $@ $(@:.o=.c)
299 $(CC) -c $(CFLAGS) $(LIBS_CFLAGS) -o $@ $(@:.o=.c)
305 $(CC) -c $(CFLAGS) $(LIBS_CFLAGS) -o $@ $(@:.o=.c)
312 $(RM) -r $(CLEAN_TARGETS)
316 …-format -style="{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 100, AlignAfterOpenBracket: Do…
320 makedepend -Y. -Y* -- *.c */*.c
327 @ANDROID_API=$(ANDROID_API) third_party/android/scripts/compile-libunwind.sh \
330 @ANDROID_API=$(ANDROID_API) third_party/android/scripts/compile-capstone.sh \
334 @ANDROID_API=$(ANDROID_API) third_party/android/scripts/compile-libBlocksRuntime.sh \
338 ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./android/Android.mk \
343 # Loop all ABIs and pass-through flags since visibility is lost due to sub-process
344 .PHONY: android-all
345 android-all:
350 @for abi in armeabi armeabi-v7a arm64-v8a x86 x86_64; do \
358 .PHONY: android-clean-deps
359 android-clean-deps:
361 make -C "third_party/android/capstone" clean; \
362 rm -rf "third_party/android/capstone/$$cpu"; \
363 make -C "third_party/android/libunwind" clean; \
364 rm -rf "third_party/android/libunwind/$$cpu"; \
365 ndk-build -C "third_party/android/libBlocksRuntime" \
367 rm -rf "third_party/android/libBlocksRuntime/$$cpu"; \
374 mkdir -p -m 755 $${DESTDIR}$(BIN_PATH)
375 install -m 755 honggfuzz $${DESTDIR}$(BIN_PATH)
376 install -m 755 hfuzz_cc/hfuzz-cc $${DESTDIR}$(BIN_PATH)
377 install -m 755 hfuzz_cc/hfuzz-clang $${DESTDIR}$(BIN_PATH)
378 install -m 755 hfuzz_cc/hfuzz-clang++ $${DESTDIR}$(BIN_PATH)
379 install -m 755 hfuzz_cc/hfuzz-gcc $${DESTDIR}$(BIN_PATH)
380 install -m 755 hfuzz_cc/hfuzz-g++ $${DESTDIR}$(BIN_PATH)
412 hfuzz_cc/hfuzz-cc.o: honggfuzz.h libhfcommon/util.h libhfcommon/common.h
413 hfuzz_cc/hfuzz-cc.o: libhfcommon/files.h libhfcommon/common.h
414 hfuzz_cc/hfuzz-cc.o: libhfcommon/log.h