mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
Update makefile.
This commit is contained in:
parent
0832c98cc0
commit
e74dadba82
34
makefile
34
makefile
|
@ -1,6 +1,6 @@
|
||||||
# C++/C Recursive Project Makefile
|
# C++/C Recursive Project Makefile
|
||||||
# (c) Jack
|
# (c) Jack
|
||||||
# Version 4
|
# Version 6 (20211110)
|
||||||
|
|
||||||
# Project Name
|
# Project Name
|
||||||
PROJECT_NAME = nstool
|
PROJECT_NAME = nstool
|
||||||
|
@ -31,8 +31,8 @@ PROJECT_SONAME = $(PROJECT_NAME).so.$(PROJECT_SO_VER_MAJOR)
|
||||||
PROJECT_SO_FILENAME = $(PROJECT_SONAME).$(PROJECT_SO_VER_MINOR).$(PROJECT_SO_VER_PATCH)
|
PROJECT_SO_FILENAME = $(PROJECT_SONAME).$(PROJECT_SO_VER_MINOR).$(PROJECT_SO_VER_PATCH)
|
||||||
|
|
||||||
# Project Dependencies
|
# Project Dependencies
|
||||||
PROJECT_DEPEND = mbedtls lz4 toolchain fmt nintendo-hac nintendo-hac-hb nintendo-es nintendo-pki
|
PROJECT_DEPEND = nintendo-hac-hb nintendo-hac nintendo-es nintendo-pki toolchain fmt lz4 mbedtls
|
||||||
PROJECT_DEPEND_LOCAL_DIR = libmbedtls liblz4 libtoolchain libfmt libnintendo-hac libnintendo-hac-hb libnintendo-es libnintendo-pki
|
PROJECT_DEPEND_LOCAL_DIR = libnintendo-hac-hb libnintendo-hac libnintendo-es libnintendo-pki libtoolchain libfmt liblz4 libmbedtls
|
||||||
|
|
||||||
# Generate compiler flags for including project include path
|
# Generate compiler flags for including project include path
|
||||||
ifneq ($(PROJECT_INCLUDE_PATH),)
|
ifneq ($(PROJECT_INCLUDE_PATH),)
|
||||||
|
@ -64,12 +64,26 @@ ifeq ($(PROJECT_PLATFORM),)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Detect Architecture
|
||||||
|
ifeq ($(PROJECT_PLATFORM_ARCH),)
|
||||||
|
ifeq ($(PROJECT_PLATFORM), WIN32)
|
||||||
|
export PROJECT_PLATFORM_ARCH = x86_64
|
||||||
|
else ifeq ($(PROJECT_PLATFORM), GNU)
|
||||||
|
export PROJECT_PLATFORM_ARCH = $(shell uname -m)
|
||||||
|
else ifeq ($(PROJECT_PLATFORM), MACOS)
|
||||||
|
export PROJECT_PLATFORM_ARCH = $(shell uname -m)
|
||||||
|
else
|
||||||
|
export PROJECT_PLATFORM_ARCH = x86_64
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Generate platform specific compiler flags
|
# Generate platform specific compiler flags
|
||||||
ifeq ($(PROJECT_PLATFORM), WIN32)
|
ifeq ($(PROJECT_PLATFORM), WIN32)
|
||||||
# Windows Flags/Libs
|
# Windows Flags/Libs
|
||||||
CC = x86_64-w64-mingw32-gcc
|
CC = x86_64-w64-mingw32-gcc
|
||||||
CXX = x86_64-w64-mingw32-g++
|
CXX = x86_64-w64-mingw32-g++
|
||||||
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-but-set-variable
|
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-but-set-variable
|
||||||
|
ARCHFLAGS =
|
||||||
INC +=
|
INC +=
|
||||||
LIB += -static
|
LIB += -static
|
||||||
ARFLAGS = cr -o
|
ARFLAGS = cr -o
|
||||||
|
@ -78,6 +92,7 @@ else ifeq ($(PROJECT_PLATFORM), GNU)
|
||||||
#CC =
|
#CC =
|
||||||
#CXX =
|
#CXX =
|
||||||
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-but-set-variable
|
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-but-set-variable
|
||||||
|
ARCHFLAGS =
|
||||||
INC +=
|
INC +=
|
||||||
LIB +=
|
LIB +=
|
||||||
ARFLAGS = cr -o
|
ARFLAGS = cr -o
|
||||||
|
@ -86,18 +101,19 @@ else ifeq ($(PROJECT_PLATFORM), MACOS)
|
||||||
#CC =
|
#CC =
|
||||||
#CXX =
|
#CXX =
|
||||||
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-private-field
|
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-private-field
|
||||||
|
ARCHFLAGS = -arch $(PROJECT_PLATFORM_ARCH)
|
||||||
INC +=
|
INC +=
|
||||||
LIB +=
|
LIB +=
|
||||||
ARFLAGS = rc
|
ARFLAGS = rc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Compiler Flags
|
# Compiler Flags
|
||||||
CXXFLAGS = -std=c++11 $(INC) $(WARNFLAGS) -fPIC
|
CXXFLAGS = -std=c++11 $(INC) $(WARNFLAGS) $(ARCHFLAGS) -fPIC
|
||||||
CFLAGS = -std=c11 $(INC) $(WARNFLAGS) -fPIC
|
CFLAGS = -std=c11 $(INC) $(WARNFLAGS) $(ARCHFLAGS) -fPIC
|
||||||
|
|
||||||
# Object Files
|
# Object Files
|
||||||
SRC_OBJ = $(foreach dir,$(PROJECT_SRC_SUBDIRS),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(PROJECT_SRC_SUBDIRS),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
SRC_OBJ = $(foreach dir,$(PROJECT_SRC_SUBDIRS),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(PROJECT_SRC_SUBDIRS),$(subst .cc,.o,$(wildcard $(dir)/*.cc))) $(foreach dir,$(PROJECT_SRC_SUBDIRS),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
||||||
TESTSRC_OBJ = $(foreach dir,$(PROJECT_TESTSRC_SUBDIRS),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(PROJECT_TESTSRC_SUBDIRS),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
TESTSRC_OBJ = $(foreach dir,$(PROJECT_TESTSRC_SUBDIRS),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(PROJECT_TESTSRC_SUBDIRS),$(subst .cc,.o,$(wildcard $(dir)/*.cc))) $(foreach dir,$(PROJECT_TESTSRC_SUBDIRS),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
||||||
|
|
||||||
# all is the default, user should specify what the default should do
|
# all is the default, user should specify what the default should do
|
||||||
# - 'static_lib' for building static library
|
# - 'static_lib' for building static library
|
||||||
|
@ -118,6 +134,10 @@ clean: clean_object_files remove_binary_dir
|
||||||
@echo CXX $<
|
@echo CXX $<
|
||||||
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.cc
|
||||||
|
@echo CXX $<
|
||||||
|
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# Binary Directory
|
# Binary Directory
|
||||||
.PHONY: create_binary_dir
|
.PHONY: create_binary_dir
|
||||||
create_binary_dir:
|
create_binary_dir:
|
||||||
|
|
Loading…
Reference in a new issue