From b1725fda79b01c449b913147fffc3a043abf23d3 Mon Sep 17 00:00:00 2001 From: jakcron Date: Fri, 8 Jan 2016 19:58:31 +0800 Subject: [PATCH] [makerom] Changed makefile Warning-less compiling on OS X --- makerom/Makefile | 27 ++++++++++++++++++++------- makerom/utils.h | 6 ++---- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/makerom/Makefile b/makerom/Makefile index 19d0505..9af706b 100644 --- a/makerom/Makefile +++ b/makerom/Makefile @@ -3,14 +3,27 @@ SRC_DIR = . polarssl libyaml OBJS = $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c))) # Compiler Settings -LIBS = -static-libgcc -CXXFLAGS = -I. -CFLAGS = --std=c99 -O2 -flto -Wall -Wno-unused-but-set-variable -Wno-unused-value -Wno-unused-result -I. $(MAKEROM_BUILD_FLAGS) +CFLAGS = --std=c99 -O2 -flto -Wall -Wno-unused-value -Wno-unused-result -I. CC = gcc -CXX = g++ +ifeq ($(OS),Windows_NT) + #Windows Build CFG + CFLAGS += -Wno-unused-but-set-variable + LIBS += -static-libgcc +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + # OS X + CFLAGS += + LIBS += -liconv + else + # Linux + CFLAGS += -Wno-unused-but-set-variable + LIBS += + endif +endif + # MAKEROM Build Settings -MAKEROM_BUILD_FLAGS = #-DDEBUG OUTPUT = makerom main: build @@ -18,7 +31,7 @@ main: build rebuild: clean build build: $(OBJS) - $(CXX) -o $(OUTPUT) $(LIBS) $(OBJS) + $(CC) -o $(OUTPUT) $(LIBS) $(OBJS) clean: - rm -rf $(OUTPUT) $(OBJS) *.cci *.cia *.cxi *.cfa + rm -rf $(OUTPUT) $(OBJS) \ No newline at end of file diff --git a/makerom/utils.h b/makerom/utils.h index 6370e41..dc8e27c 100644 --- a/makerom/utils.h +++ b/makerom/utils.h @@ -18,7 +18,7 @@ u64 min64(u64 a, u64 b); u64 max64(u64 a, u64 b); // Strings -void memdump(FILE* fout, const char* prefix, const const u8* data, u32 size); +void memdump(FILE* fout, const char* prefix, const u8* data, u32 size); char* replace_filextention(const char *input, const char *extention); // Base64 @@ -52,6 +52,4 @@ u32 u8_to_u32(const u8 *value, u8 endianness); u64 u8_to_u64(const u8 *value, u8 endianness); int u16_to_u8(u8 *out_value, u16 in_value, u8 endianness); int u32_to_u8(u8 *out_value, u32 in_value, u8 endianness); -int u64_to_u8(u8 *out_value, u64 in_value, u8 endianness); - - +int u64_to_u8(u8 *out_value, u64 in_value, u8 endianness); \ No newline at end of file