From 6630e108b2bb7dddecdf5a9a8d2178af6bcf3dbe Mon Sep 17 00:00:00 2001 From: jakcron Date: Sat, 17 Mar 2018 15:59:38 +0800 Subject: [PATCH] Support Compiling on MacOS --- lib/libcrypto/makefile | 26 ++++++++++++++++++-------- lib/libes/makefile | 26 ++++++++++++++++++-------- lib/libfnd/makefile | 26 ++++++++++++++++++-------- lib/libnx/makefile | 26 ++++++++++++++++++-------- 4 files changed, 72 insertions(+), 32 deletions(-) diff --git a/lib/libcrypto/makefile b/lib/libcrypto/makefile index e763fae..d440c11 100644 --- a/lib/libcrypto/makefile +++ b/lib/libcrypto/makefile @@ -9,18 +9,28 @@ INCS = -I"include" -I"source/libpolarssl/include" $(foreach dep,$(DEPENDS), -I"$ # Compiler Settings -CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-but-set-variable -Wno-unused-value -CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-but-set-variable -Wno-unused-value +CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value +CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value +ARFLAGS = cr -o ifeq ($(OS),Windows_NT) # Windows Only Flags/Libs CC = x86_64-w64-mingw32-gcc CXX = x86_64-w64-mingw32-g++ - CFLAGS += - CXXFLAGS += + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable else - # *nix Only Flags/Libs - CFLAGS += - CXXFLAGS += + UNAME = $(shell uname -s) + ifeq ($(UNAME), Darwin) + # MacOS Only Flags/Libs + CFLAGS += -Wunused-private-field + CXXFLAGS += -Wunused-private-field + ARFLAGS = rc + else + # *nix Only Flags/Libs + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable + endif + endif # Output @@ -31,7 +41,7 @@ main: build rebuild: clean build build: $(OBJS) - ar cr -o $(OUTPUT) $(OBJS) + ar $(ARFLAGS) $(OUTPUT) $(OBJS) clean: rm -rf $(OUTPUT) $(OBJS) \ No newline at end of file diff --git a/lib/libes/makefile b/lib/libes/makefile index 920e98d..3f707e4 100644 --- a/lib/libes/makefile +++ b/lib/libes/makefile @@ -9,18 +9,28 @@ INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include") # Compiler Settings -CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-but-set-variable -Wno-unused-value -CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-but-set-variable -Wno-unused-value +CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value +CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value +ARFLAGS = cr -o ifeq ($(OS),Windows_NT) # Windows Only Flags/Libs CC = x86_64-w64-mingw32-gcc CXX = x86_64-w64-mingw32-g++ - CFLAGS += - CXXFLAGS += + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable else - # *nix Only Flags/Libs - CFLAGS += - CXXFLAGS += + UNAME = $(shell uname -s) + ifeq ($(UNAME), Darwin) + # MacOS Only Flags/Libs + CFLAGS += -Wunused-private-field + CXXFLAGS += -Wunused-private-field + ARFLAGS = rc + else + # *nix Only Flags/Libs + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable + endif + endif # Output @@ -31,7 +41,7 @@ main: build rebuild: clean build build: $(OBJS) - ar cr -o $(OUTPUT) $(OBJS) + ar $(ARFLAGS) $(OUTPUT) $(OBJS) clean: rm -rf $(OUTPUT) $(OBJS) \ No newline at end of file diff --git a/lib/libfnd/makefile b/lib/libfnd/makefile index f2d86c3..e9b75b4 100644 --- a/lib/libfnd/makefile +++ b/lib/libfnd/makefile @@ -9,18 +9,28 @@ INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include") # Compiler Settings -CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-but-set-variable -Wno-unused-value -CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-but-set-variable -Wno-unused-value +CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value +CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value +ARFLAGS = cr -o ifeq ($(OS),Windows_NT) # Windows Only Flags/Libs CC = x86_64-w64-mingw32-gcc CXX = x86_64-w64-mingw32-g++ - CFLAGS += - CXXFLAGS += + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable else - # *nix Only Flags/Libs - CFLAGS += - CXXFLAGS += + UNAME = $(shell uname -s) + ifeq ($(UNAME), Darwin) + # MacOS Only Flags/Libs + CFLAGS += -Wunused-private-field + CXXFLAGS += -Wunused-private-field + ARFLAGS = rc + else + # *nix Only Flags/Libs + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable + endif + endif # Output @@ -31,7 +41,7 @@ main: build rebuild: clean build build: $(OBJS) - ar cr -o $(OUTPUT) $(OBJS) + ar $(ARFLAGS) $(OUTPUT) $(OBJS) clean: rm -rf $(OUTPUT) $(OBJS) \ No newline at end of file diff --git a/lib/libnx/makefile b/lib/libnx/makefile index 920e98d..3f707e4 100644 --- a/lib/libnx/makefile +++ b/lib/libnx/makefile @@ -9,18 +9,28 @@ INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include") # Compiler Settings -CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-but-set-variable -Wno-unused-value -CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-but-set-variable -Wno-unused-value +CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value +CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value +ARFLAGS = cr -o ifeq ($(OS),Windows_NT) # Windows Only Flags/Libs CC = x86_64-w64-mingw32-gcc CXX = x86_64-w64-mingw32-g++ - CFLAGS += - CXXFLAGS += + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable else - # *nix Only Flags/Libs - CFLAGS += - CXXFLAGS += + UNAME = $(shell uname -s) + ifeq ($(UNAME), Darwin) + # MacOS Only Flags/Libs + CFLAGS += -Wunused-private-field + CXXFLAGS += -Wunused-private-field + ARFLAGS = rc + else + # *nix Only Flags/Libs + CFLAGS += -Wno-unused-but-set-variable + CXXFLAGS += -Wno-unused-but-set-variable + endif + endif # Output @@ -31,7 +41,7 @@ main: build rebuild: clean build build: $(OBJS) - ar cr -o $(OUTPUT) $(OBJS) + ar $(ARFLAGS) $(OUTPUT) $(OBJS) clean: rm -rf $(OUTPUT) $(OBJS) \ No newline at end of file