mirror of
https://github.com/jakcron/nstool
synced 2024-12-25 14:11:14 +00:00
Update makefile.
This commit is contained in:
parent
0832c98cc0
commit
e74dadba82
1 changed files with 27 additions and 7 deletions
34
makefile
34
makefile
|
@ -1,6 +1,6 @@
|
|||
# C++/C Recursive Project Makefile
|
||||
# (c) Jack
|
||||
# Version 4
|
||||
# Version 6 (20211110)
|
||||
|
||||
# Project Name
|
||||
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 Dependencies
|
||||
PROJECT_DEPEND = mbedtls lz4 toolchain fmt nintendo-hac nintendo-hac-hb nintendo-es nintendo-pki
|
||||
PROJECT_DEPEND_LOCAL_DIR = libmbedtls liblz4 libtoolchain libfmt libnintendo-hac libnintendo-hac-hb libnintendo-es libnintendo-pki
|
||||
PROJECT_DEPEND = nintendo-hac-hb nintendo-hac nintendo-es nintendo-pki toolchain fmt lz4 mbedtls
|
||||
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
|
||||
ifneq ($(PROJECT_INCLUDE_PATH),)
|
||||
|
@ -64,12 +64,26 @@ ifeq ($(PROJECT_PLATFORM),)
|
|||
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
|
||||
ifeq ($(PROJECT_PLATFORM), WIN32)
|
||||
# Windows Flags/Libs
|
||||
CC = x86_64-w64-mingw32-gcc
|
||||
CXX = x86_64-w64-mingw32-g++
|
||||
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-but-set-variable
|
||||
ARCHFLAGS =
|
||||
INC +=
|
||||
LIB += -static
|
||||
ARFLAGS = cr -o
|
||||
|
@ -78,6 +92,7 @@ else ifeq ($(PROJECT_PLATFORM), GNU)
|
|||
#CC =
|
||||
#CXX =
|
||||
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-but-set-variable
|
||||
ARCHFLAGS =
|
||||
INC +=
|
||||
LIB +=
|
||||
ARFLAGS = cr -o
|
||||
|
@ -86,18 +101,19 @@ else ifeq ($(PROJECT_PLATFORM), MACOS)
|
|||
#CC =
|
||||
#CXX =
|
||||
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-private-field
|
||||
ARCHFLAGS = -arch $(PROJECT_PLATFORM_ARCH)
|
||||
INC +=
|
||||
LIB +=
|
||||
ARFLAGS = rc
|
||||
endif
|
||||
|
||||
# Compiler Flags
|
||||
CXXFLAGS = -std=c++11 $(INC) $(WARNFLAGS) -fPIC
|
||||
CFLAGS = -std=c11 $(INC) $(WARNFLAGS) -fPIC
|
||||
CXXFLAGS = -std=c++11 $(INC) $(WARNFLAGS) $(ARCHFLAGS) -fPIC
|
||||
CFLAGS = -std=c11 $(INC) $(WARNFLAGS) $(ARCHFLAGS) -fPIC
|
||||
|
||||
# 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)))
|
||||
TESTSRC_OBJ = $(foreach dir,$(PROJECT_TESTSRC_SUBDIRS),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(PROJECT_TESTSRC_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 .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
|
||||
# - 'static_lib' for building static library
|
||||
|
@ -118,6 +134,10 @@ clean: clean_object_files remove_binary_dir
|
|||
@echo CXX $<
|
||||
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.cc
|
||||
@echo CXX $<
|
||||
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
# Binary Directory
|
||||
.PHONY: create_binary_dir
|
||||
create_binary_dir:
|
||||
|
|
Loading…
Reference in a new issue