Setup build enviorment
This commit is contained in:
parent
90eac84874
commit
0c52689ebe
|
@ -5,6 +5,7 @@
|
|||
/iso
|
||||
|
||||
*.dep
|
||||
*.a
|
||||
*.o
|
||||
*.ii
|
||||
*.s
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
#Build architecture/variant string, possible values: x86, armv7le, etc...
|
||||
PLATFORM ?= PSX
|
||||
|
||||
#Build profile, possible values: release, debug, profile, coverage
|
||||
BUILD_DIR ?= bin
|
||||
BUILD_PROFILE ?= debug
|
||||
|
||||
CONFIG_NAME ?= $(PLATFORM)-$(BUILD_PROFILE)
|
||||
OUTPUT_DIR = $(BUILD_DIR)/$(CONFIG_NAME)
|
||||
TARGET = $(OUTPUT_DIR)/$(ARTIFACT)
|
||||
|
||||
#Compiler definitions
|
||||
HAS_LINUX_MIPS_GCC = $(shell which mipsel-linux-gnu-gcc > /dev/null 2> /dev/null && echo true || echo false)
|
||||
ifeq ($(HAS_LINUX_MIPS_GCC),true)
|
||||
PREFIX ?= mipsel-linux-gnu
|
||||
FORMAT ?= elf32-tradlittlemips
|
||||
else
|
||||
PREFIX ?= mipsel-none-elf
|
||||
FORMAT ?= elf32-littlemips
|
||||
endif
|
||||
|
||||
CC ?= $(PREFIX)-gcc-10
|
||||
CXX ?= $(PREFIX)-g++-10
|
||||
LD ?= $(CXX)
|
||||
AR ?= ar
|
||||
|
||||
#architecture flags
|
||||
ARCHFLAGS = -march=mips1 -mabi=32 -EL -fno-pic -mno-shared -mno-abicalls -mfp32
|
||||
ARCHFLAGS += -fno-stack-protector -nostdlib -ffreestanding
|
||||
|
||||
#Compiler flags for build profiles
|
||||
CCFLAGS_release += -O3
|
||||
CCFLAGS_debug += -O0
|
||||
|
||||
CXXFLAGS += -fno-exceptions -fno-rtti
|
||||
|
||||
USE_FUNCTION_SECTIONS ?= true
|
||||
ifeq ($(USE_FUNCTION_SECTIONS),true)
|
||||
CCFLAGS_all += -ffunction-sections
|
||||
endif
|
||||
CCFLAGS_all += -mno-gpopt -fomit-frame-pointer
|
||||
CCFLAGS_all += -fno-builtin -fno-strict-aliasing -Wno-attributes
|
||||
CCFLAGS_all += $(ARCHFLAGS)
|
||||
|
||||
CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE))
|
||||
|
||||
#Linker flags
|
||||
LDFLAGS_release += -Os
|
||||
|
||||
LDFLAGS_all += -Wl,-Map=$(TARGET).map -nostdlib -T$(LDSCRIPT) -static -Wl,--gc-sections -Wl,--build-id=none
|
||||
LDFLAGS_all += $(ARCHFLAGS) -Wl,--oformat=$(FORMAT)
|
||||
LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE))
|
||||
|
||||
LIBS_all += $(LIBS_$(BUILD_PROFILE))
|
||||
|
||||
DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@
|
||||
|
||||
#Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp
|
||||
rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))
|
||||
|
||||
#Object files list
|
||||
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(subst ..,!super,$(basename $(SRCS)))))
|
||||
|
||||
#Compiling rule
|
||||
$(OUTPUT_DIR)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -c $(DEPS) -o $@ $(CCFLAGS_all) $(CCFLAGS) $<
|
||||
|
||||
$(OUTPUT_DIR)/%.o: %.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS_all) $(CXXFLAGS) $<
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(OUTPUT_DIR)/%.o: $$(subst !super,..,%.s)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(ARCHFLAGS) -I$(PCSX_REDUX) -g -c -o $@ $<
|
||||
|
||||
#Linking rule
|
||||
$(TARGET).a: $(OBJS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(AR) rcs $(TARGET).a $(OBJS)
|
||||
|
||||
|
||||
$(TARGET).elf: $(OBJS)
|
||||
$(LD) -o $(TARGET).elf $(LDFLAGS_all) $(LDFLAGS) $(OBJS) $(LIBS_all) $(LIBS)
|
||||
|
||||
#Strips the psexe
|
||||
$(TARGET).psexe: $(TARGET).elf
|
||||
$(PREFIX)-objcopy $(addprefix -R , $(OVERLAYSECTION)) -O binary $< $@
|
||||
|
||||
#Rules section for default compilation and linking
|
||||
rebuild:
|
||||
$(MAKE) clean
|
||||
$(MAKE) all
|
||||
|
||||
#Inclusion of dependencies (object files to source and includes)
|
||||
-include $(OBJS:%.o=%.d)
|
|
@ -0,0 +1,13 @@
|
|||
@echo off
|
||||
rem build_all [clean]
|
||||
|
||||
set build_type=build
|
||||
|
||||
IF NOT "%~1" == "" (
|
||||
set build_type=%~1
|
||||
)
|
||||
|
||||
cd src\Library
|
||||
call run_make.bat %build_type% release
|
||||
cd ..\Tools\
|
||||
call build_all.bat %build_type%
|
|
@ -1,13 +1,58 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"name": "JabyEngine",
|
||||
"path": ".",
|
||||
},
|
||||
{
|
||||
"name": "Include",
|
||||
"path": "..\\..\\include"
|
||||
},
|
||||
{
|
||||
"name": "JabyEngine",
|
||||
"path": "."
|
||||
"name": "Root",
|
||||
"path": "..\\.."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "make",
|
||||
"type": "shell",
|
||||
"command": "./run_make.bat ${input:target} ${input:build cfg}",
|
||||
"group": {
|
||||
"kind": "build"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "all",
|
||||
"type": "shell",
|
||||
"command": "./build_all.bat ${input:target}",
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"options": {
|
||||
"cwd": "../.."
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"id": "build cfg",
|
||||
"type": "pickString",
|
||||
"options": ["debug", "release"],
|
||||
"default": "release",
|
||||
"description": "build configuration"
|
||||
},
|
||||
{
|
||||
"id": "target",
|
||||
"type": "pickString",
|
||||
"options": ["build", "clean", "rebuild"],
|
||||
"default": "build",
|
||||
"description": "build target",
|
||||
}
|
||||
]
|
||||
},
|
||||
"settings": {},
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
ARTIFACT = libJabyEngine
|
||||
BUILD_DIR = ../../lib
|
||||
|
||||
include ../../Makefile
|
||||
|
||||
#Rules section for default compilation and linking
|
||||
all: $(TARGET).a
|
||||
|
||||
clean:
|
||||
rm -fr $(OUTPUT_DIR)
|
|
@ -0,0 +1,11 @@
|
|||
@echo off
|
||||
rem run_make.bat build|clean|rebuild debug|release
|
||||
|
||||
IF %1 == build (
|
||||
set make_target=all
|
||||
) else (
|
||||
set make_target=%1
|
||||
)
|
||||
|
||||
@echo make %make_target% BUILD_PROFILE=%2
|
||||
wsl make %make_target% BUILD_PROFILE=%2
|
|
@ -0,0 +1,3 @@
|
|||
int wuff() {
|
||||
return 0;
|
||||
}
|
|
@ -18,6 +18,6 @@ IF NOT "%~1" == "" (
|
|||
)
|
||||
|
||||
for %%a in (%projects%) do (
|
||||
call run_cargo %%a %build_type% release
|
||||
call .\run_cargo %%a %build_type% release
|
||||
cd %cur_dir%
|
||||
)
|
||||
|
|
|
@ -24,6 +24,7 @@ IF %2 == check (
|
|||
IF %2 == clean (
|
||||
echo cargo clean %1
|
||||
cargo clean
|
||||
@del %org_dir%\..\..\bin\%1.exe
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue