mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-02 16:59:03 +00:00
Rework libpolarssl to be standalone dependency for makerom.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#ifndef POLARSSL_AES_H
|
||||
#define POLARSSL_AES_H
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -181,7 +181,7 @@ int aes_crypt_ctr( aes_context *ctx,
|
||||
#endif
|
||||
|
||||
#else /* POLARSSL_AES_ALT */
|
||||
#include "polarssl/aes_alt.h"
|
||||
#include <polarssl/aes_alt.h>
|
||||
#endif /* POLARSSL_AES_ALT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <basetsd.h>
|
||||
@@ -41,7 +41,7 @@
|
||||
#ifndef POLARSSL_BN_MUL_H
|
||||
#define POLARSSL_BN_MUL_H
|
||||
|
||||
#include "polarssl/bignum.h"
|
||||
#include <polarssl/bignum.h>
|
||||
|
||||
#if defined(POLARSSL_HAVE_ASM)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef POLARSSL_RSA_H
|
||||
#define POLARSSL_RSA_H
|
||||
|
||||
#include "polarssl/bignum.h"
|
||||
#include <polarssl/bignum.h>
|
||||
|
||||
/*
|
||||
* RSA Error codes
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef POLARSSL_SHA1_H
|
||||
#define POLARSSL_SHA1_H
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -94,7 +94,7 @@ void sha1_process( sha1_context *ctx, const unsigned char data[64] );
|
||||
#endif
|
||||
|
||||
#else /* POLARSSL_SHA1_ALT */
|
||||
#include "polarssl/sha1_alt.h"
|
||||
#include <polarssl/sha1_alt.h>
|
||||
#endif /* POLARSSL_SHA1_ALT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef POLARSSL_SHA2_H
|
||||
#define POLARSSL_SHA2_H
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
# C++/C Recursive Project Makefile
|
||||
# (c) Jack
|
||||
# Version 6 (20211110)
|
||||
|
||||
# Project Name
|
||||
PROJECT_NAME = libpolarssl
|
||||
|
||||
# Project Relative Paths
|
||||
PROJECT_PATH = $(CURDIR)
|
||||
PROJECT_SRC_PATH = src
|
||||
PROJECT_SRC_SUBDIRS = $(PROJECT_SRC_PATH)
|
||||
PROJECT_INCLUDE_PATH = include
|
||||
#PROJECT_TESTSRC_PATH = test
|
||||
#PROJECT_TESTSRC_SUBDIRS = $(PROJECT_TESTSRC_PATH)
|
||||
PROJECT_BIN_PATH = bin
|
||||
#PROJECT_DOCS_PATH = docs
|
||||
#PROJECT_DOXYFILE_PATH = Doxyfile
|
||||
|
||||
# Determine if the root makefile has been established, and if not establish this makefile as the root makefile
|
||||
ifeq ($(ROOT_PROJECT_NAME),)
|
||||
export ROOT_PROJECT_NAME = $(PROJECT_NAME)
|
||||
export ROOT_PROJECT_PATH = $(PROJECT_PATH)
|
||||
export ROOT_PROJECT_DEPENDENCY_PATH = $(ROOT_PROJECT_PATH)/deps
|
||||
endif
|
||||
|
||||
# Shared Library Definitions
|
||||
PROJECT_SO_VER_MAJOR = 0
|
||||
PROJECT_SO_VER_MINOR = 1
|
||||
PROJECT_SO_VER_PATCH = 0
|
||||
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 =
|
||||
PROJECT_DEPEND_LOCAL_DIR =
|
||||
|
||||
# Generate compiler flags for including project include path
|
||||
ifneq ($(PROJECT_INCLUDE_PATH),)
|
||||
INC += -I"$(PROJECT_INCLUDE_PATH)"
|
||||
endif
|
||||
|
||||
# Generate compiler flags for local included dependencies
|
||||
ifneq ($(PROJECT_DEPEND_LOCAL_DIR),)
|
||||
LIB += $(foreach dep,$(PROJECT_DEPEND_LOCAL_DIR), -L"$(ROOT_PROJECT_DEPENDENCY_PATH)/$(dep)/bin")
|
||||
INC += $(foreach dep,$(PROJECT_DEPEND_LOCAL_DIR), -I"$(ROOT_PROJECT_DEPENDENCY_PATH)/$(dep)/include")
|
||||
endif
|
||||
|
||||
# Generate compiler flags for external dependencies
|
||||
ifneq ($(PROJECT_DEPEND),)
|
||||
LIB += $(foreach dep,$(PROJECT_DEPEND), -l$(dep))
|
||||
endif
|
||||
|
||||
# Detect Platform
|
||||
ifeq ($(PROJECT_PLATFORM),)
|
||||
ifeq ($(OS), Windows_NT)
|
||||
export PROJECT_PLATFORM = WIN32
|
||||
else
|
||||
UNAME = $(shell uname -s)
|
||||
ifeq ($(UNAME), Darwin)
|
||||
export PROJECT_PLATFORM = MACOS
|
||||
else
|
||||
export PROJECT_PLATFORM = GNU
|
||||
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
|
||||
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
|
||||
else ifeq ($(PROJECT_PLATFORM), GNU)
|
||||
# GNU/Linux Flags/Libs
|
||||
#CC =
|
||||
#CXX =
|
||||
WARNFLAGS = -Wall -Wno-unused-value -Wno-unused-but-set-variable
|
||||
ARCHFLAGS =
|
||||
INC +=
|
||||
LIB +=
|
||||
ARFLAGS = cr -o
|
||||
else ifeq ($(PROJECT_PLATFORM), MACOS)
|
||||
# MacOS Flags/Libs
|
||||
#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) $(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 .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
|
||||
# - 'shared_lib' for building shared library
|
||||
# - 'program' for building the program
|
||||
# - 'test_program' for building the test program
|
||||
# These can typically be used together however *_lib and program should not be used together
|
||||
all: static_lib
|
||||
|
||||
clean: clean_object_files remove_binary_dir
|
||||
|
||||
# Object Compile Rules
|
||||
%.o: %.c
|
||||
@echo CC $<
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.cpp
|
||||
@echo CXX $<
|
||||
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.cc
|
||||
@echo CXX $<
|
||||
@$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
# Binary Directory
|
||||
.PHONY: create_binary_dir
|
||||
create_binary_dir:
|
||||
@mkdir -p "$(PROJECT_BIN_PATH)"
|
||||
|
||||
.PHONY: remove_binary_dir
|
||||
remove_binary_dir:
|
||||
ifneq ($(PROJECT_BIN_PATH),)
|
||||
@rm -rf "$(PROJECT_BIN_PATH)"
|
||||
endif
|
||||
|
||||
.PHONY: clean_object_files
|
||||
clean_object_files:
|
||||
@rm -f $(SRC_OBJ) $(TESTSRC_OBJ)
|
||||
|
||||
# Build Library
|
||||
static_lib: $(SRC_OBJ) create_binary_dir
|
||||
@echo LINK $(PROJECT_BIN_PATH)/$(PROJECT_NAME).a
|
||||
@ar $(ARFLAGS) "$(PROJECT_BIN_PATH)/$(PROJECT_NAME).a" $(SRC_OBJ)
|
||||
|
||||
shared_lib: $(SRC_OBJ) create_binary_dir
|
||||
@echo LINK $(PROJECT_BIN_PATH)/$(PROJECT_SO_FILENAME)
|
||||
@gcc -shared -Wl,-soname,$(PROJECT_SONAME) -o "$(PROJECT_BIN_PATH)/$(PROJECT_SO_FILENAME)" $(SRC_OBJ)
|
||||
|
||||
# Build Program
|
||||
program: $(SRC_OBJ) create_binary_dir
|
||||
@echo LINK $(PROJECT_BIN_PATH)/$(PROJECT_NAME)
|
||||
@$(CXX) $(ARCHFLAGS) $(SRC_OBJ) $(LIB) -o "$(PROJECT_BIN_PATH)/$(PROJECT_NAME)"
|
||||
|
||||
# Build Test Program
|
||||
test_program: $(TESTSRC_OBJ) $(SRC_OBJ) create_binary_dir
|
||||
ifneq ($(PROJECT_TESTSRC_PATH),)
|
||||
@echo LINK $(PROJECT_BIN_PATH)/$(PROJECT_NAME)_test
|
||||
@$(CXX) $(ARCHFLAGS) $(TESTSRC_OBJ) $(SRC_OBJ) $(LIB) -o "$(PROJECT_BIN_PATH)/$(PROJECT_NAME)_test"
|
||||
endif
|
||||
|
||||
# Documentation
|
||||
.PHONY: docs
|
||||
docs:
|
||||
ifneq ($(PROJECT_DOCS_PATH),)
|
||||
doxygen "$(PROJECT_DOXYFILE_PATH)"
|
||||
endif
|
||||
|
||||
.PHONY: clean_docs
|
||||
clean_docs:
|
||||
ifneq ($(PROJECT_DOCS_PATH),)
|
||||
@rm -rf "$(PROJECT_DOCS_PATH)"
|
||||
endif
|
||||
|
||||
# Dependencies
|
||||
.PHONY: deps
|
||||
deps:
|
||||
@$(foreach lib,$(PROJECT_DEPEND_LOCAL_DIR), cd "$(ROOT_PROJECT_DEPENDENCY_PATH)/$(lib)" && $(MAKE) static_lib && cd "$(PROJECT_PATH)";)
|
||||
|
||||
.PHONY: clean_deps
|
||||
clean_deps:
|
||||
@$(foreach lib,$(PROJECT_DEPEND_LOCAL_DIR), cd "$(ROOT_PROJECT_DEPENDENCY_PATH)/$(lib)" && $(MAKE) clean && cd "$(PROJECT_PATH)";)
|
||||
@@ -29,13 +29,13 @@
|
||||
* http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#if defined(POLARSSL_AES_C)
|
||||
|
||||
#include "polarssl/aes.h"
|
||||
#include <polarssl/aes.h>
|
||||
#if defined(POLARSSL_PADLOCK_C)
|
||||
#include "polarssl/padlock.h"
|
||||
#include <polarssl/padlock.h>
|
||||
#endif
|
||||
|
||||
#if !defined(POLARSSL_AES_ALT)
|
||||
@@ -23,11 +23,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#if defined(POLARSSL_BASE64_C)
|
||||
|
||||
#include "polarssl/base64.h"
|
||||
#include <polarssl/base64.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <basetsd.h>
|
||||
@@ -30,12 +30,12 @@
|
||||
* http://math.libtomcrypt.com/files/tommath.pdf
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#if defined(POLARSSL_BIGNUM_C)
|
||||
|
||||
#include "polarssl/bignum.h"
|
||||
#include "polarssl/bn_mul.h"
|
||||
#include <polarssl/bignum.h>
|
||||
#include <polarssl/bn_mul.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
* http://www.cacr.math.uwaterloo.ca/hac/about/chap8.pdf
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
|
||||
#include "polarssl/rsa.h"
|
||||
#include <polarssl/rsa.h>
|
||||
|
||||
#if defined(POLARSSL_PKCS1_V21)
|
||||
#include "polarssl/md.h"
|
||||
#include <polarssl/md.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -1283,7 +1283,7 @@ void rsa_free( rsa_context *ctx )
|
||||
|
||||
#if defined(POLARSSL_SELF_TEST)
|
||||
|
||||
#include "polarssl/sha1.h"
|
||||
#include <polarssl/sha1.h>
|
||||
|
||||
/*
|
||||
* Example RSA-1024 keypair, for test purposes
|
||||
@@ -28,11 +28,11 @@
|
||||
* http://www.itl.nist.gov/fipspubs/fip180-1.htm
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#if defined(POLARSSL_SHA1_C)
|
||||
|
||||
#include "polarssl/sha1.h"
|
||||
#include <polarssl/sha1.h>
|
||||
|
||||
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
|
||||
#include <stdio.h>
|
||||
@@ -28,11 +28,11 @@
|
||||
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
|
||||
*/
|
||||
|
||||
#include "polarssl/config.h"
|
||||
#include <polarssl/config.h>
|
||||
|
||||
#if defined(POLARSSL_SHA2_C)
|
||||
|
||||
#include "polarssl/sha2.h"
|
||||
#include <polarssl/sha2.h>
|
||||
|
||||
#if defined(POLARSSL_FS_IO) || defined(POLARSSL_SELF_TEST)
|
||||
#include <stdio.h>
|
||||
Reference in New Issue
Block a user