flatten 20260225
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.DS_Store
|
||||
*.pyc
|
||||
xcuserdata
|
||||
.bin
|
||||
transfer-to-*
|
||||
195
Core_Make.xcodeproj/project.pbxproj
Normal file
195
Core_Make.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,195 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
F68F48702E6DBCD2007C3E32 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
|
||||
F6F858C52E7C3119002A1971 /* ReadMe.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = ReadMe.md; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFileSystemSynchronizedRootGroup section */
|
||||
F6F10D612E38053A0082E9D9 /* tjp */ = {
|
||||
isa = PBXFileSystemSynchronizedRootGroup;
|
||||
explicitFileTypes = {
|
||||
Make/Makefile.bin = sourcecode.make;
|
||||
};
|
||||
path = tjp;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXFileSystemSynchronizedRootGroup section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
F6F10D3C2E3804C90082E9D9 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
F68F48702E6DBCD2007C3E32 /* LICENSE */,
|
||||
F6F858C52E7C3119002A1971 /* ReadMe.md */,
|
||||
F6F10D612E38053A0082E9D9 /* tjp */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
F6F10D3D2E3804C90082E9D9 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastUpgradeCheck = 1630;
|
||||
};
|
||||
buildConfigurationList = F6F10D402E3804C90082E9D9 /* Build configuration list for PBXProject "Core_Make" */;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = F6F10D3C2E3804C90082E9D9;
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = F6F10D3C2E3804C90082E9D9;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
F6F10D472E3804C90082E9D9 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = T2M28D3T75;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 15.4;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
F6F10D482E3804C90082E9D9 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = T2M28D3T75;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 15.4;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
F6F10D402E3804C90082E9D9 /* Build configuration list for PBXProject "Core_Make" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
F6F10D472E3804C90082E9D9 /* Debug */,
|
||||
F6F10D482E3804C90082E9D9 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = F6F10D3D2E3804C90082E9D9 /* Project object */;
|
||||
}
|
||||
26
LICENSE
Executable file
26
LICENSE
Executable file
@@ -0,0 +1,26 @@
|
||||
MIT NON-AI License
|
||||
|
||||
Copyright (c) 2025, Timothy Prepscius
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of the software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
In addition, the following restrictions apply:
|
||||
|
||||
1. The Software and any modifications made to it may not be used for the purpose of training or improving machine learning algorithms,
|
||||
including but not limited to artificial intelligence, natural language processing, or data mining. This condition applies to any derivatives,
|
||||
modifications, or updates based on the Software code. Any usage of the Software in an AI-training dataset is considered a breach of this License.
|
||||
|
||||
2. The Software may not be included in any dataset used for training or improving machine learning algorithms,
|
||||
including but not limited to artificial intelligence, natural language processing, or data mining.
|
||||
|
||||
3. Any person or organization found to be in violation of these restrictions will be subject to legal action and may be held liable
|
||||
for any damages resulting from such use.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
141
ReadMe.md
Executable file
141
ReadMe.md
Executable file
@@ -0,0 +1,141 @@
|
||||
# Core_Zero
|
||||
|
||||
Basic foundational classes
|
||||
|
||||
|
||||
## Building
|
||||
|
||||
Most of Core_Zero is header-only.
|
||||
To enable header-only use:
|
||||
`#define TJP_CORE_HEADER_ONLY`
|
||||
|
||||
The entire Core_Zero project will be converted to header only compatible soon.
|
||||
|
||||
To build all of the project use these steps.
|
||||
|
||||
```
|
||||
mkdir my_project
|
||||
cd my_project
|
||||
|
||||
git clone http://github.com/timprepscius/Core_Libraries
|
||||
git clone http://github.com/timprepscius/Core_Zero
|
||||
git clone http://github.com/timprepscius/Core_Make
|
||||
cd Core_Zero
|
||||
make
|
||||
|
||||
cd tests
|
||||
make
|
||||
.bin/Core_Zero_Tests.exe
|
||||
|
||||
```
|
||||
|
||||
|
||||
## How to use
|
||||
|
||||
### Locks
|
||||
|
||||
```
|
||||
// ----------------------------------------
|
||||
// example for locks
|
||||
// ----------------------------------------
|
||||
void example_lock_tjp()
|
||||
{
|
||||
Mutex mutex;
|
||||
|
||||
auto lock = lock_of(mutex);
|
||||
do_something();
|
||||
|
||||
auto should_send_signal = true;
|
||||
if (should_send_signal)
|
||||
{
|
||||
auto unlock = unlock_of(mutex);
|
||||
do_something();
|
||||
}
|
||||
}
|
||||
|
||||
// using std
|
||||
void example_lock_cpp()
|
||||
{
|
||||
std::mutex mutex;
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
do_something();
|
||||
|
||||
auto should_send_signal = true;
|
||||
if (should_send_signal)
|
||||
{
|
||||
try
|
||||
{
|
||||
mutex.unlock();
|
||||
do_something();
|
||||
mutex.lock();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
mutex.lock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Maps
|
||||
|
||||
```
|
||||
// ----------------------------------------
|
||||
// example for maps
|
||||
// ----------------------------------------
|
||||
void example_map_tjp()
|
||||
{
|
||||
Map<int, int> map;
|
||||
if (auto value = map_value(map, 42))
|
||||
do_something_with(*value);
|
||||
|
||||
if (auto value = map_value_erase(map, 42))
|
||||
do_something_with(*value);
|
||||
}
|
||||
|
||||
|
||||
// using std
|
||||
void example_map_cpp()
|
||||
{
|
||||
std::map<int, int> map;
|
||||
auto i = map.find(42);
|
||||
if (i != map.end())
|
||||
{
|
||||
do_something_with(*i);
|
||||
}
|
||||
|
||||
auto j = map.find(42);
|
||||
if (j != map.end())
|
||||
{
|
||||
auto v = std::move(j->second);
|
||||
map.erase(j);
|
||||
|
||||
do_something_with(v);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Range iteration
|
||||
```
|
||||
// ----------------------------------------
|
||||
// example for range
|
||||
// ----------------------------------------
|
||||
void example_range_tjp()
|
||||
{
|
||||
for (auto i: range(42))
|
||||
do_something_with(i);
|
||||
}
|
||||
|
||||
// using std
|
||||
void example_range_cpp()
|
||||
{
|
||||
for (auto k=0; k<42; ++k)
|
||||
do_something_with(k);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Other examples
|
||||
|
||||
Look at `Core_Zero/Examples.cpp` for more examples on how to use this library.
|
||||
61
tjp/Make/Makefile
Executable file
61
tjp/Make/Makefile
Executable file
@@ -0,0 +1,61 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
#
|
||||
# Todo: make the ifeq (Darwin...) go away
|
||||
#
|
||||
|
||||
include $(dir $(realpath $(lastword $(MAKEFILE_LIST))))/Makefile.base
|
||||
|
||||
.PHONY: all
|
||||
all:
|
||||
$(MAKE) build
|
||||
ifeq ("Darwin-YES","$(SYS_NAME)-$(BUILD_ALL)")
|
||||
SYS_SDK=Darwin SYS_NAME=iOS SYS_PLATFORM=simulate $(MAKE) build
|
||||
SYS_SDK=Darwin SYS_NAME=iOS SYS_PLATFORM=arm64 $(MAKE) build
|
||||
endif
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
$(MAKE) _debug
|
||||
$(MAKE) _release
|
||||
$(MAKE) _release_log
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(MAKE) remove
|
||||
ifeq ("Darwin-YES","$(SYS_NAME)-$(BUILD_ALL)")
|
||||
SYS_SDK=Darwin SYS_NAME=iOS SYS_PLATFORM=simulate $(MAKE) remove
|
||||
SYS_SDK=Darwin SYS_NAME=iOS SYS_PLATFORM=arm64 $(MAKE) remove
|
||||
endif
|
||||
|
||||
.PHONY: remove
|
||||
remove:
|
||||
$(RM) $(OUTPATH)/Debug.$(EXT)
|
||||
$(RM) $(OUTPATH)/Release.$(EXT)
|
||||
$(RM) $(OUTPATH)/ReleaseLog.$(EXT)
|
||||
ifeq ("YES","$(DELETE_ALL)")
|
||||
$(RM) $(OUTPATH)
|
||||
endif
|
||||
|
||||
MAKE_PROJECT_FILE ?= Makefile.project
|
||||
|
||||
.PHONY: _debug
|
||||
_debug :
|
||||
$(MAKE_MULTI) -f $(MAKE_PROJECT_FILE) CONFIG=Debug BUILD_PCH=true MAKEDIR=$(MAKEDIR) build
|
||||
$(MAKE_MULTI) -f $(MAKE_PROJECT_FILE) CONFIG=Debug MAKEDIR=$(MAKEDIR) build
|
||||
|
||||
.PHONY: _release
|
||||
_release :
|
||||
$(MAKE_MULTI) -f $(MAKE_PROJECT_FILE) CONFIG=Release BUILD_PCH=true MAKEDIR=$(MAKEDIR) build
|
||||
$(MAKE_MULTI) -f $(MAKE_PROJECT_FILE) CONFIG=Release MAKEDIR=$(MAKEDIR) build
|
||||
|
||||
.PHONY: _release_log
|
||||
_release_log :
|
||||
$(MAKE_MULTI) -f $(MAKE_PROJECT_FILE) CONFIG=ReleaseLog BUILD_PCH=true MAKEDIR=$(MAKEDIR) build
|
||||
$(MAKE_MULTI) -f $(MAKE_PROJECT_FILE) CONFIG=ReleaseLog MAKEDIR=$(MAKEDIR) build
|
||||
|
||||
|
||||
15
tjp/Make/Makefile-all
Normal file
15
tjp/Make/Makefile-all
Normal file
@@ -0,0 +1,15 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
TOPTARGETS := all clean _debug _release _release_log
|
||||
|
||||
SUBDIRS := $(filter-out make.cpp/,$(dir $(wildcard */Makefile.project)))
|
||||
|
||||
$(TOPTARGETS): $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
||||
.PHONY: $(TOPTARGETS) $(SUBDIRS)
|
||||
123
tjp/Make/Makefile.base
Executable file
123
tjp/Make/Makefile.base
Executable file
@@ -0,0 +1,123 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
MAKEDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
ROOTDIR := $(or $(ROOTDIR), $(realpath $(dir $(firstword $(MAKEFILE_LIST)))..))
|
||||
|
||||
GIT_VERSION := $(shell git describe --abbrev=4 --dirty --always)
|
||||
|
||||
IS_DEBUG := true
|
||||
ifeq (,$(findstring Debug,$(CONFIG)))
|
||||
IS_DEBUG := false
|
||||
endif
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
UNAME_M := $(shell uname -m)
|
||||
|
||||
SYS_NAME ?= $(UNAME_S)
|
||||
SYS_SDK ?= $(SYS_NAME)
|
||||
SYS_PLATFORM ?= $(UNAME_M)
|
||||
SIMULATE ?= yes
|
||||
|
||||
#############################
|
||||
MAKE := make ROOTDIR="$(ROOTDIR)"
|
||||
RM := rm -rf
|
||||
#RM := echo
|
||||
COPY = cp
|
||||
# TIMEIT := time
|
||||
TIMEIT :=
|
||||
|
||||
#############################
|
||||
CFLAGS ?=
|
||||
CPPFLAGS ?=
|
||||
MMFLAGS ?=
|
||||
MFLAGS ?=
|
||||
_FLAGS ?=
|
||||
LDFLAGS ?=
|
||||
VISIBILITY_FLAGS_C ?=
|
||||
VISIBILITY_FLAGS_CPP ?=
|
||||
BUILD_FLAGS ?=
|
||||
BUILD_PCH_FLAGS ?=
|
||||
EXT ?= $(SYS_NAME)-$(SYS_PLATFORM)
|
||||
BUILD_ALL ?= YES
|
||||
SECTIONS_FLAGS_C ?= -ffunction-sections -fdata-sections
|
||||
|
||||
|
||||
#############################
|
||||
BIN := .bin
|
||||
OUTPATH := $(BIN)
|
||||
OBJDIR := $(CONFIG).$(EXT)
|
||||
OBJPATH := $(OUTPATH)/$(OBJDIR)
|
||||
|
||||
#############################
|
||||
-include $(ROOTDIR)/*/Libraries.def
|
||||
LIBRARIES ?= $(ROOTDIR)/Core_Libraries
|
||||
LIBRARIES_PROJECT ?= $(LIBRARIES)/project
|
||||
$(info LIBRARIES = $(LIBRARIES))
|
||||
|
||||
#############################
|
||||
include $(MAKEDIR)/Makefile.base.*
|
||||
|
||||
#############################
|
||||
USE_ASAN ?= false
|
||||
ifeq ($(USE_ASAN),true)
|
||||
_FLAGS += -fsanitize=address
|
||||
LDFLAGS += -fsanitize=address -static-libasan
|
||||
endif
|
||||
|
||||
#############################
|
||||
MAKE_MULTI := $(MAKE) -j $(JOBS)
|
||||
|
||||
#############################
|
||||
_FLAGS += -c
|
||||
# -ftime-trace \
|
||||
# -g
|
||||
|
||||
USE_DEPENDENCIES ?= 1
|
||||
############################
|
||||
# USE dependencies
|
||||
ifeq ($(USE_DEPENDENCIES),1)
|
||||
DEPENDENCY_FLAGS := -MMD
|
||||
endif
|
||||
|
||||
_FLAGS += $(DEPENDENCY_FLAGS)
|
||||
VISIBILITY_FLAGS_C := $(VISIBILITY_FLAGS_C) -fvisibility=hidden
|
||||
VISIBILITY_FLAGS_CPP := $(VISIBILITY_FLAGS_CPP) -fvisibility-inlines-hidden -fno-rtti
|
||||
|
||||
# allow data areas to be removed
|
||||
VISIBILITY_FLAGS_C := $(VISIBILITY_FLAGS_C) $(SECTIONS_FLAGS_C)
|
||||
|
||||
CPP_VERSION ?= -std=c++17
|
||||
|
||||
CFLAGS := $(CFLAGS) $(VISIBILITY_FLAGS_C)
|
||||
CPPFLAGS := $(CPPFLAGS) $(CPP_VERSION) -fpermissive $(VISIBILITY_FLAGS_C) $(VISIBILITY_FLAGS_CPP) -Wno-invalid-offsetof
|
||||
MMFLAGS := $(MMFLAGS) $(CPP_VERSION) -fpermissive -fobjc-arc $(VISIBILITY_FLAGS_C) $(VISIBILITY_FLAGS_CPP) -Wno-invalid-offsetof
|
||||
MFLAGS := $(MFLAGS) -fpermissive -fobjc-arc $(VISIBILITY_FLAGS_C)
|
||||
|
||||
BUILD_PCH_FLAGS += -x c++-header
|
||||
|
||||
###########################################################
|
||||
ifeq ($(IS_DEBUG),false)
|
||||
_FLAGS += -O3 -DNDEBUG
|
||||
OBJDIR_NOLOG := Release.$(EXT)
|
||||
|
||||
ifeq (,$(findstring Log,$(CONFIG)))
|
||||
else
|
||||
_FLAGS += -DLOG_DEBUG
|
||||
endif
|
||||
else
|
||||
_FLAGS += -g -D_DEBUG -O0 -DDEBUG=1
|
||||
OBJDIR_NOLOG := Debug.$(EXT)
|
||||
endif
|
||||
|
||||
|
||||
###########################################################
|
||||
#MAKEFILE_LIST_SAVE := $(MAKEFILE_LIST)
|
||||
|
||||
$(info ROOTDIR = $(ROOTDIR))
|
||||
-include $(ROOTDIR)/*/Makefile.def
|
||||
-include $(LIBRARIES)/ext/*/Makefile.def
|
||||
#MAKEFILE_LIST := $(MAKEFILE_LIST_SAVE)
|
||||
34
tjp/Make/Makefile.base.android
Executable file
34
tjp/Make/Makefile.base.android
Executable file
@@ -0,0 +1,34 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
ifeq (Android,$(SYS_NAME))
|
||||
TOOLS := $(NDK)/toolchains/llvm/prebuilt/$(HOST_TAG)/bin
|
||||
AR := $(TOOLS)/llvm-ar
|
||||
|
||||
CC := $(TIMEIT) $(TOOLS)/clang
|
||||
CPP := $(TIMEIT) $(TOOLS)/clang++
|
||||
MM := $(TIMEIT) $(TOOLS)/clang++
|
||||
M := $(TIMEIT) $(TOOLS)/clang
|
||||
LINK := $(TIMEIT) $(TOOLS)/llvm-link
|
||||
SHARED_LINK := $(TIMEIT) $(TOOLS)/ld
|
||||
|
||||
TARGET := aarch64-none-linux-android26
|
||||
SYSROOT := $(NDK)/toolchains/llvm/prebuilt/$(HOST_TAG)/sysroot
|
||||
|
||||
CPPFLAGS += -stdlib=libc++
|
||||
MMFLAGS += -stdlib=libc++
|
||||
_FLAGS += \
|
||||
-Wno-null-conversion \
|
||||
-Wno-extra-tokens \
|
||||
-Wno-int-to-void-pointer-cast \
|
||||
-Wno-deprecated-register \
|
||||
-target $(TARGET) \
|
||||
--sysroot=$(SYSROOT) \
|
||||
-D SYS_ANDROID -D SYS_ARM64 \
|
||||
-fPIC \
|
||||
-D VULKAN_MINIMAL
|
||||
|
||||
endif
|
||||
39
tjp/Make/Makefile.base.cuda
Executable file
39
tjp/Make/Makefile.base.cuda
Executable file
@@ -0,0 +1,39 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
ifeq (Cuda,$(SYS_NAME))
|
||||
|
||||
# Somehow on linux dockers, under colima, dependencies
|
||||
# cause problems -
|
||||
# USE_DEPENDENCIES := 0
|
||||
|
||||
GCCC := nvcc
|
||||
|
||||
AR := ar
|
||||
CC := ${GCCC}
|
||||
CPP := ${GCCC}
|
||||
MM := ${GCCC}
|
||||
M := ${GCCC}
|
||||
LINK := ${GCCC}
|
||||
|
||||
_FLAGS += \
|
||||
-DSYS_LINUX \
|
||||
-DSYS_X86 \
|
||||
-DUSE_CUDA \
|
||||
-ldl -lm -lstdc++ -pthread \
|
||||
-Wno-stringop-overflow \
|
||||
-Wno-stringop-overread \
|
||||
-fno-omit-frame-pointer
|
||||
|
||||
# not needed with newer boost
|
||||
# -DBOOST_NO_CXX98_FUNCTION_BASE=1
|
||||
# -Wno-changes-meaning does not work
|
||||
|
||||
LDFLAGS += -L /usr/local/lib
|
||||
|
||||
PLATFORM_LIBS := -ldl -lm -lstdc++ -pthread
|
||||
|
||||
endif
|
||||
42
tjp/Make/Makefile.base.darwin
Executable file
42
tjp/Make/Makefile.base.darwin
Executable file
@@ -0,0 +1,42 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
ifeq (Darwin,$(SYS_NAME))
|
||||
|
||||
ifeq (arm64,$(SYS_PLATFORM))
|
||||
AR := libtool
|
||||
ARFLAGS := -c -o
|
||||
|
||||
CC := $(TIMEIT) llvm-gcc
|
||||
CPP := $(TIMEIT) llvm-g++
|
||||
MM := $(TIMEIT) llvm-gcc
|
||||
M := $(TIMEIT) llvm-gcc
|
||||
LINK := $(TIMEIT) llvm-gcc
|
||||
|
||||
CPPFLAGS += -stdlib=libc++
|
||||
MMFLAGS += -stdlib=libc++
|
||||
_FLAGS += -Wno-null-conversion -Wno-extra-tokens -Wno-int-to-void-pointer-cast -Wno-deprecated-register -target arm64-apple-macos11.0 -arch arm64
|
||||
_FLAGS += -DSYS_OSX -DSYS_ARM64
|
||||
|
||||
else
|
||||
|
||||
AR := libtool
|
||||
ARFLAGS := -c -o
|
||||
|
||||
CC := $(TIMEIT) llvm-gcc
|
||||
CPP := $(TIMEIT) llvm-g++
|
||||
MM := $(TIMEIT) llvm-gcc
|
||||
M := $(TIMEIT) llvm-gcc
|
||||
LINK := $(TIMEIT) llvm-gcc
|
||||
|
||||
CPPFLAGS += -stdlib=libc++
|
||||
MMFLAGS += -stdlib=libc++
|
||||
_FLAGS += -Wno-null-conversion -Wno-extra-tokens -Wno-int-to-void-pointer-cast -Wno-deprecated-register -target x86_64-apple-macos10.15 -arch x86_64
|
||||
|
||||
_FLAGS += -DSYS_OSX -DSYS_X86
|
||||
endif
|
||||
|
||||
endif
|
||||
80
tjp/Make/Makefile.base.ios
Executable file
80
tjp/Make/Makefile.base.ios
Executable file
@@ -0,0 +1,80 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
ifeq (iOS,$(SYS_NAME))
|
||||
DEVELOPER := /Applications/Xcode.app/Contents/Developer
|
||||
CPPFLAGS += -stdlib=libc++
|
||||
MMFLAGS += -stdlib=libc++
|
||||
|
||||
_FLAGS += -Wno-null-conversion -Wno-extra-tokens -Wno-int-to-void-pointer-cast -Wno-deprecated-register
|
||||
|
||||
###########################################################
|
||||
# IOS SIMULATOR
|
||||
ifeq ($(SYS_PLATFORM),simulate)
|
||||
|
||||
DEVDIR := $(DEVELOPER)/Toolchains/XcodeDefault.xctoolchain/
|
||||
CC := $(DEVDIR)/usr/bin/clang -x c
|
||||
CPP := $(DEVDIR)/usr/bin/clang -x c++
|
||||
MM := $(DEVDIR)/usr/bin/clang -x objective-c++
|
||||
M := $(DEVDIR)/usr/bin/clang -x objective-c
|
||||
LINK := echo
|
||||
|
||||
# arm64 architecture for newer macs
|
||||
_FLAGS += -DSYS_IPHONE -DSYS_ARM64
|
||||
# _FLAGS += -arch arm64
|
||||
|
||||
# x86_64 for older macs
|
||||
# _FLAGS += -arch x86_64
|
||||
# _FLAGS += -DSYS_IPHONE -DSYS_X86
|
||||
|
||||
# i386 for a long time ago
|
||||
# _FLAGS += -arch i386
|
||||
|
||||
_FLAGS += -DSYS_IPHONE_SIMULATE
|
||||
_FLAGS += -Wno-import
|
||||
_FLAGS += -fobjc-abi-version=2
|
||||
_FLAGS += -fobjc-legacy-dispatch
|
||||
_FLAGS += -isysroot $(DEVELOPER)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
|
||||
_FLAGS += -mios-simulator-version-min=12.0
|
||||
|
||||
CFLAGS += -Wno-implicit-function-declaration
|
||||
|
||||
AR := libtool
|
||||
ARFLAGS := -c -o
|
||||
|
||||
LDFLAGS += -Xlinker -objc_abi_version -Xlinker 2
|
||||
LDFLAGS += -lobjc
|
||||
LDFLAGS += -framework Foundation -framework UIKit -framework CoreGraphics
|
||||
|
||||
###########################################################
|
||||
# IOS PHONE
|
||||
else
|
||||
|
||||
DEVDIR := $(DEVELOPER)/Toolchains/XcodeDefault.xctoolchain/
|
||||
CC := $(DEVDIR)/usr/bin/clang -x c
|
||||
CPP := $(DEVDIR)/usr/bin/clang -x c++
|
||||
MM := $(DEVDIR)/usr/bin/clang -x objective-c++
|
||||
M := $(DEVDIR)/usr/bin/clang -x objective-c
|
||||
LINK := $(DEVDIR)/usr/bin/clang
|
||||
LINK := echo
|
||||
|
||||
AR := libtool
|
||||
ARFLAGS := -c -o
|
||||
|
||||
_FLAGS += -DSYS_IPHONE -DSYS_ARM64
|
||||
_FLAGS += -fembed-bitcode
|
||||
SECTIONS_FLAGS_C :=
|
||||
|
||||
CFLAGS += -Wno-implicit-function-declaration
|
||||
|
||||
# _FLAGS += -fembed-bitcode-marker
|
||||
_FLAGS += -Wno-import
|
||||
_FLAGS += -arch arm64
|
||||
_FLAGS += -isysroot $(DEVELOPER)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
|
||||
_FLAGS += -miphoneos-version-min=12.0
|
||||
endif
|
||||
|
||||
endif
|
||||
34
tjp/Make/Makefile.base.jobs
Executable file
34
tjp/Make/Makefile.base.jobs
Executable file
@@ -0,0 +1,34 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
ifeq ($(SYS_NAME),Linux)
|
||||
|
||||
HOSTNAME_S := $(shell hostname)
|
||||
ifeq ($(HOSTNAME_S),320f8287df69)
|
||||
JOBS ?= 8
|
||||
else ifeq ($(HOSTNAME_S),lava)
|
||||
JOBS ?= 8
|
||||
else ifeq ($(HOSTNAME_S),purple)
|
||||
JOBS ?= 8
|
||||
else ifeq ($(HOSTNAME_S),yellow)
|
||||
JOBS ?= 8
|
||||
else
|
||||
JOBS ?= 4
|
||||
endif
|
||||
|
||||
else ifeq ($(SYS_NAME),Darwin)
|
||||
|
||||
ifeq ($(SYS_PLATFORM),arm64)
|
||||
JOBS ?= 16
|
||||
else
|
||||
JOBS ?= 4
|
||||
endif
|
||||
else
|
||||
JOBS ?= 2
|
||||
endif
|
||||
|
||||
JOBS ?= 4
|
||||
|
||||
38
tjp/Make/Makefile.base.linux
Executable file
38
tjp/Make/Makefile.base.linux
Executable file
@@ -0,0 +1,38 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
ifeq (Linux,$(SYS_NAME))
|
||||
|
||||
# Somehow on linux dockers, under colima, dependencies
|
||||
# cause problems -
|
||||
# USE_DEPENDENCIES := 0
|
||||
|
||||
GCCC := gcc
|
||||
|
||||
AR := ar
|
||||
CC := ${GCCC}
|
||||
CPP := ${GCCC}
|
||||
MM := ${GCCC}
|
||||
M := ${GCCC}
|
||||
LINK := ${GCCC}
|
||||
|
||||
_FLAGS += \
|
||||
-DSYS_LINUX \
|
||||
-DSYS_X86 \
|
||||
-ldl -lm -lstdc++ -pthread \
|
||||
-Wno-stringop-overflow \
|
||||
-Wno-stringop-overread \
|
||||
-fno-omit-frame-pointer
|
||||
|
||||
# not needed with newer boost
|
||||
# -DBOOST_NO_CXX98_FUNCTION_BASE=1
|
||||
# -Wno-changes-meaning does not work
|
||||
|
||||
LDFLAGS += -L /usr/local/lib
|
||||
|
||||
PLATFORM_LIBS := -ldl -lm -lstdc++ -pthread
|
||||
|
||||
endif
|
||||
31
tjp/Make/Makefile.base.llvm
Executable file
31
tjp/Make/Makefile.base.llvm
Executable file
@@ -0,0 +1,31 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
ifeq (LLVM,$(SYS_NAME))
|
||||
DEVELOPER := /Applications/Xcode.app/Contents/Developer
|
||||
DEVDIR := $(DEVELOPER)/Platforms/iPhoneOS.platform/Developer
|
||||
|
||||
AR := ar
|
||||
CC := clang
|
||||
CPP := clang++
|
||||
MM := clang
|
||||
M := clang
|
||||
LINK := clang
|
||||
CPPFLAGS += -stdlib=libc++
|
||||
MMFLAGS += -stdlib=libc++
|
||||
MFLAGS += -stdlib=libc++
|
||||
_FLAGS += -Wno-null-conversion -Wno-extra-tokens -Wno-int-to-void-pointer-cast -Wno-deprecated-register
|
||||
|
||||
_FLAGS += -Wno-import
|
||||
# _FLAGS += -Werror
|
||||
# _FLAGS += -arch armv6
|
||||
_FLAGS += -mthumb
|
||||
_FLAGS += -isysroot $(DEVELOPER)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
|
||||
_FLAGS += -miphoneos-version-min=11.0
|
||||
_FLAGS += -DSYS_LLVM
|
||||
|
||||
_FLAGS += -emit-llvm -target le32-unknown-nacl
|
||||
endif
|
||||
20
tjp/Make/Makefile.bin
Executable file
20
tjp/Make/Makefile.bin
Executable file
@@ -0,0 +1,20 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
#include $(SELF_DIR)/Makefile.base
|
||||
include $(SELF_DIR)/Makefile.src
|
||||
|
||||
ifdef BUILD_PCH
|
||||
include $(SELF_DIR)/Makefile.build_pch
|
||||
else
|
||||
include $(SELF_DIR)/Makefile.build_bin
|
||||
endif
|
||||
|
||||
all: build
|
||||
|
||||
|
||||
43
tjp/Make/Makefile.build_bin
Executable file
43
tjp/Make/Makefile.build_bin
Executable file
@@ -0,0 +1,43 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
EXE := $(OBJPATH)/$(EXEFILE)
|
||||
|
||||
LDPATH_NO_L = $(filter-out -L%,$(LDPATH))
|
||||
LIB_DIRS = $(patsubst -L%,%,$(LDPATH_NO_L))
|
||||
resolve_lib = $(firstword $(foreach dir,$(LIB_DIRS),$(wildcard $(dir)/lib$1.a $(dir)/lib$1.so)))
|
||||
LIB_DEPS = $(foreach lib,$(filter -l%,$(LIBS) $(PLATFORM_LIBS)),$(call resolve_lib,$(patsubst -l%,%,$(lib))))
|
||||
|
||||
#$(info $$LDPATH is [${LDPATH}])
|
||||
#$(info $$LDPATH_NO_L is [${LDPATH_NO_L}])
|
||||
#$(info $$LIB_DIRS is [${LIB_DIRS}])
|
||||
#$(info $$LIB_DEPS is [${LIB_DEPS}])
|
||||
|
||||
|
||||
$(EXE): $(OBJ) $(LIB_DEPS)
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(LINK) $(LDFLAGS) $(LDPATH) $(OBJ) $(LIBS) $(PLATFORM_LIBS) -o $@
|
||||
|
||||
ifneq ("$(COPY_RESOURCES)","")
|
||||
cp -p -r $(COPY_RESOURCES) $(OBJPATH)/
|
||||
endif
|
||||
|
||||
ifneq ($(COPYTO),)
|
||||
-@mkdir -p $(COPYTO)/$(OBJDIR)
|
||||
@while [ ! -e $(COPYTO)/$(OBJDIR) ]; do sleep 0.1; done
|
||||
cp -p $(EXE) $(COPYTO)/$(OBJDIR)
|
||||
|
||||
ifneq ("$(COPY_RESOURCES)","")
|
||||
cp -p -r $(COPY_RESOURCES) $(COPYTO)/$(OBJDIR)/
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
exe: $(EXE)
|
||||
build: exe
|
||||
21
tjp/Make/Makefile.build_lib
Executable file
21
tjp/Make/Makefile.build_lib
Executable file
@@ -0,0 +1,21 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
LIB := $(OBJPATH)/$(LIBFILE)
|
||||
|
||||
$(LIB) : $(OBJ)
|
||||
$(AR) $(ARFLAGS) $(LIB) $(OBJ)
|
||||
|
||||
ifneq ($(COPYTO),)
|
||||
-@mkdir -p $(COPYTO)/$(OBJDIR)
|
||||
@while [ ! -e $(COPYTO)/$(OBJDIR) ]; do sleep 0.1; done
|
||||
cp -p $(LIB) $(COPYTO)/$(OBJDIR)
|
||||
endif
|
||||
|
||||
lib : $(LIB)
|
||||
build: lib
|
||||
37
tjp/Make/Makefile.build_pch
Executable file
37
tjp/Make/Makefile.build_pch
Executable file
@@ -0,0 +1,37 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
ifneq ($(strip $(PCH)),)
|
||||
|
||||
PCH_OUT := $(OBJPATH)/Precompile.pch.gch
|
||||
|
||||
############################
|
||||
# USE dependencies
|
||||
ifeq ($(USE_DEPENDENCIES),1)
|
||||
PCH_DEPS := $(PCH_OUT:%.gch=%.d)
|
||||
|
||||
$(info $$PCH_OUT is [${PCH_OUT}])
|
||||
#$(info $$PCH_DEPS is [${PCH_DEPS}])
|
||||
-include $(PCH_DEPS)
|
||||
endif
|
||||
|
||||
$(PCH_OUT): $(PCH)
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(CPP) $(INCPATH) $(BUILD_PCH_FLAGS) $(_FLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
lib : $(PCH_OUT)
|
||||
|
||||
else
|
||||
|
||||
lib:
|
||||
|
||||
endif
|
||||
|
||||
|
||||
build: lib
|
||||
43
tjp/Make/Makefile.build_shared_lib
Executable file
43
tjp/Make/Makefile.build_shared_lib
Executable file
@@ -0,0 +1,43 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
EXE := $(OBJPATH)/$(SHAREDLIBFILE)
|
||||
|
||||
LDPATH_NO_L = $(filter-out -L%,$(LDPATH))
|
||||
LIB_DIRS = $(patsubst -L%,%,$(LDPATH_NO_L))
|
||||
resolve_lib = $(firstword $(foreach dir,$(LIB_DIRS),$(wildcard $(dir)/lib$1.a $(dir)/lib$1.so)))
|
||||
LIB_DEPS = $(foreach lib,$(filter -l%,$(LIBS) $(PLATFORM_LIBS)),$(call resolve_lib,$(patsubst -l%,%,$(lib))))
|
||||
|
||||
#$(info $$LDPATH is [${LDPATH}])
|
||||
#$(info $$LDPATH_NO_L is [${LDPATH_NO_L}])
|
||||
#$(info $$LIB_DIRS is [${LIB_DIRS}])
|
||||
#$(info $$LIB_DEPS is [${LIB_DEPS}])
|
||||
|
||||
$(EXE): $(OBJ) $(LIB_DEPS)
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(SHARED_LINK) $(LDFLAGS) $(LDPATH) $< -shared $(LIBS) $(PLATFORM_LIBS) -o $@
|
||||
|
||||
ifneq ("$(COPY_RESOURCES)","")
|
||||
cp -p -r $(COPY_RESOURCES) $(OBJPATH)/
|
||||
endif
|
||||
|
||||
ifneq ($(COPYTO),)
|
||||
-@mkdir -p $(COPYTO)/$(OBJDIR)
|
||||
@while [ ! -e $(COPYTO)/$(OBJDIR) ]; do sleep 0.1; done
|
||||
cp -p $(EXE) $(COPYTO)/$(OBJDIR)
|
||||
|
||||
# must not be indented for a makefile
|
||||
ifneq ("$(COPY_RESOURCES)","")
|
||||
cp -p -r $(COPY_RESOURCES) $(COPYTO)/$(OBJDIR)/
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
exe: $(EXE)
|
||||
build: exe
|
||||
19
tjp/Make/Makefile.lib
Executable file
19
tjp/Make/Makefile.lib
Executable file
@@ -0,0 +1,19 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
include $(SELF_DIR)/Makefile.src
|
||||
|
||||
ifdef BUILD_PCH
|
||||
include $(SELF_DIR)/Makefile.build_pch
|
||||
else
|
||||
include $(SELF_DIR)/Makefile.build_lib
|
||||
endif
|
||||
|
||||
all: build
|
||||
|
||||
|
||||
12
tjp/Make/Makefile.none
Normal file
12
tjp/Make/Makefile.none
Normal file
@@ -0,0 +1,12 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
19
tjp/Make/Makefile.shared_lib
Executable file
19
tjp/Make/Makefile.shared_lib
Executable file
@@ -0,0 +1,19 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
include $(SELF_DIR)/Makefile.src
|
||||
|
||||
ifdef BUILD_PCH
|
||||
include $(SELF_DIR)/Makefile.build_pch
|
||||
else
|
||||
include $(SELF_DIR)/Makefile.build_shared_lib
|
||||
endif
|
||||
|
||||
all: build
|
||||
|
||||
|
||||
136
tjp/Make/Makefile.src
Executable file
136
tjp/Make/Makefile.src
Executable file
@@ -0,0 +1,136 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
#$(info $$PROJECTS is [${PROJECTS}])
|
||||
|
||||
SRC_C := $(foreach dir,$(PROJECTS),$(wildcard $(dir)/*.c)) $(SRC_C)
|
||||
SRC_CPP := $(foreach dir,$(PROJECTS),$(wildcard $(dir)/*.cpp)) $(SRC_CPP)
|
||||
SRC_CC := $(foreach dir,$(PROJECTS),$(wildcard $(dir)/*.cc)) $(SRC_CC)
|
||||
|
||||
SRC_MM := $(foreach dir,$(PROJECTS),$(wildcard $(dir)/*.mm)) $(SRC_MM)
|
||||
SRC_M := $(foreach dir,$(PROJECTS),$(wildcard $(dir)/*.m)) $(SRC_M)
|
||||
|
||||
$(info $$IS_TEST is [${IS_TEST}])
|
||||
ifneq (true,$(IS_TEST))
|
||||
FILTER_OUT_C := $(FILTER_OUT_C) %Test.c %Tests.c
|
||||
FILTER_OUT_CPP := $(FILTER_OUT_CPP) %Test.cpp %Tests.cpp
|
||||
FILTER_OUT_MM := $(FILTER_OUT_MM) %Test.mm %Tests.mm
|
||||
FILTER_OUT_M := $(FILTER_OUT_M) %Test.m %Tests.m
|
||||
endif
|
||||
|
||||
ifneq ($(FILTER_CPP),)
|
||||
SRC_CPP := $(filter $(FILTER_CPP),$(SRC_CPP))
|
||||
endif
|
||||
SRC_CPP := $(filter-out $(FILTER_OUT_CPP),$(SRC_CPP))
|
||||
|
||||
ifneq ($(FILTER_C),)
|
||||
SRC_C := $(filter $(FILTER_C),$(SRC_C))
|
||||
endif
|
||||
SRC_C := $(filter-out $(FILTER_OUT_C),$(SRC_C))
|
||||
|
||||
ifneq ($(FILTER_MM),)
|
||||
SRC_MM := $(filter $(FILTER_MM),$(SRC_MM))
|
||||
endif
|
||||
SRC_MM := $(filter-out $(FILTER_OUT_MM),$(SRC_MM))
|
||||
|
||||
ifneq ($(FILTER_M),)
|
||||
SRC_M := $(filter $(FILTER_M),$(SRC_M))
|
||||
endif
|
||||
SRC_M := $(filter-out $(FILTER_OUT_M),$(SRC_M))
|
||||
|
||||
SRC := $(SRC_C) $(SRC_CPP) $(SRC_CC) $(SRC_MM) $(SRC_M) $(SRC)
|
||||
SRC_CPP := $(filter %.cpp,$(SRC))
|
||||
SRC_C := $(filter %.c,$(SRC))
|
||||
SRC_MM := $(filter %.mm,$(SRC))
|
||||
SRC_CC := $(filter %.cc,$(SRC))
|
||||
SRC_M := $(filter %.m,$(SRC))
|
||||
|
||||
OBJ := \
|
||||
$(SRC_CPP:%.cpp=%.o) \
|
||||
$(SRC_CC:%.cc=%.o) \
|
||||
$(SRC_MM:%.mm=%.o) \
|
||||
$(SRC_C:%.c=%.o) \
|
||||
$(SRC_M:%.m=%.o)
|
||||
|
||||
OBJ := $(patsubst ../%,external/%,$(OBJ))
|
||||
OBJ := $(addprefix $(OBJPATH)/,$(OBJ))
|
||||
|
||||
#$(info $$OBJ is [${OBJ}])
|
||||
|
||||
############################
|
||||
# USE dependencies
|
||||
ifeq ($(USE_DEPENDENCIES),1)
|
||||
DEPS := $(wildcard $(OBJ:%.o=%.d))
|
||||
#$(info $$DEPS is [${DEPS}])
|
||||
-include $(DEPS)
|
||||
endif
|
||||
|
||||
PCH := $(SRC_PCH)
|
||||
$(info $$PCH is [${PCH}])
|
||||
|
||||
ifneq ($(strip $(PCH)),)
|
||||
BUILD_FLAGS := $(BUILD_FLAGS) -include $(OBJPATH)/Precompile.pch
|
||||
endif
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
INCPATH += $(foreach d, $(includes), -I$d)
|
||||
|
||||
$(info $$_FLAGS is [${_FLAGS}])
|
||||
|
||||
$(OBJPATH)/%.o : %.cpp
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(CPP) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/%.o : %.cc
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(CPP) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/%.o : %.mm
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(MM) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(MMFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/%.o : %.m
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(M) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(MFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/%.o : %.c
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(CC) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
## -------------------------------------------
|
||||
## for externals (which occur for compile tests)
|
||||
## -------------------------------------------
|
||||
|
||||
$(OBJPATH)/external/%.o : ../%.cpp
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(CPP) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/external/%.o : ../%.cc
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(CPP) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(CPPFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/external/%.o : ../%.mm
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(MM) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(MMFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/external/%.o : ../%.m
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(M) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(MFLAGS) $< -o $@
|
||||
|
||||
$(OBJPATH)/external/%.o : ../%.c
|
||||
-@mkdir -p $(dir $@)
|
||||
@while [ ! -e $(dir $@) ]; do sleep 0.1; done
|
||||
$(CC) $(INCPATH) $(BUILD_FLAGS) $(_FLAGS) $(CFLAGS) $< -o $@
|
||||
6
tjp/Make/makefile.def
Executable file
6
tjp/Make/makefile.def
Executable file
@@ -0,0 +1,6 @@
|
||||
###################################
|
||||
# License: Modified MIT (NON-AI)
|
||||
# Copyright 2025 Timothy Prepscius
|
||||
# See the LICENSE file in the root directory for license information.
|
||||
###################################
|
||||
|
||||
Reference in New Issue
Block a user