mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-11 08:36:38 -04:00
Refactor some console makefiles
This commit is contained in:
parent
cce29a87e1
commit
3f9627b776
@ -1,19 +1,3 @@
|
|||||||
BUILD_DIR := build/dc
|
|
||||||
SOURCE_DIRS := src third_party/bearssl/src misc/dreamcast
|
|
||||||
TARGET := ClassiCube-dc
|
|
||||||
|
|
||||||
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
|
||||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
|
||||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
|
||||||
CFLAGS := -g -DNDEBUG -O3 -fipa-pta -fno-pie -flto=auto -fomit-frame-pointer -fbuiltin -ffast-math -ffp-contract=fast -mfsrra -mfsca -pipe -fno-math-errno -Ithird_party/bearssl/inc
|
|
||||||
|
|
||||||
# Dependency tracking
|
|
||||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
|
||||||
DEPFILES := $(OBJS:%.o=%.d)
|
|
||||||
|
|
||||||
LDFLAGS = -g
|
|
||||||
LIBS = -lm -lppp -lkosfat
|
|
||||||
|
|
||||||
ifeq ($(strip $(KOS_BASE)),)
|
ifeq ($(strip $(KOS_BASE)),)
|
||||||
$(warning Please set KOS variables in your environment. For example:)
|
$(warning Please set KOS variables in your environment. For example:)
|
||||||
$(warning source /opt/toolchains/dc/kos/environ.sh)
|
$(warning source /opt/toolchains/dc/kos/environ.sh)
|
||||||
@ -22,7 +6,36 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# Configurable options
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Directory where object files are placed
|
||||||
|
BUILD_DIR := build/dc
|
||||||
|
# List of directories containing source code
|
||||||
|
SOURCE_DIRS := src third_party/bearssl/src misc/dreamcast
|
||||||
|
# Name of the final output
|
||||||
|
TARGET := ClassiCube-dc
|
||||||
|
# Additional libraries to link against
|
||||||
|
LIBS = -lm -lppp -lkosfat
|
||||||
|
# List of directories containing more header files
|
||||||
|
INCLUDES = -Ithird_party/bearssl/inc
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Code generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||||
|
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||||
|
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||||
|
CFLAGS := -g -DNDEBUG -O3 -fipa-pta -fno-pie -flto=auto -fomit-frame-pointer -fbuiltin -ffast-math -ffp-contract=fast -mfsrra -mfsca -pipe -fno-math-errno
|
||||||
|
LDFLAGS = -g
|
||||||
|
|
||||||
|
# Dependency tracking
|
||||||
|
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||||
|
DEPFILES := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
default: $(BUILD_DIR) $(TARGET).cdi
|
default: $(BUILD_DIR) $(TARGET).cdi
|
||||||
|
|
||||||
@ -34,7 +47,7 @@ $(BUILD_DIR):
|
|||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# executable generation
|
# Executable generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(TARGET).elf: $(OBJS)
|
$(TARGET).elf: $(OBJS)
|
||||||
kos-cc $(LDFLAGS) $^ -o $@ $(LIBS)
|
kos-cc $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||||
@ -63,18 +76,21 @@ $(TARGET).cdi: $(TARGET).iso
|
|||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# object generation
|
# Object generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(BUILD_DIR)/%.o: src/%.c
|
$(BUILD_DIR)/%.o: src/%.c
|
||||||
kos-cc $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
kos-cc $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
||||||
kos-cc $(CFLAGS) -c $< -o $@
|
kos-cc $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: misc/dreamcast/%.S
|
$(BUILD_DIR)/%.o: misc/dreamcast/%.S
|
||||||
kos-cc $(DEPFLAGS) -c $< -o $@
|
kos-cc $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
# Dependency tracking
|
# Dependency tracking
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
$(DEPFILES):
|
$(DEPFILES):
|
||||||
|
|
||||||
include $(wildcard $(DEPFILES))
|
include $(wildcard $(DEPFILES))
|
||||||
|
122
misc/gc/Makefile
122
misc/gc/Makefile
@ -1,102 +1,74 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Clear the implicit built in rules
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
.SECONDARY:
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITPPC)),)
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(DEVKITPPC)/gamecube_rules
|
include $(DEVKITPPC)/gamecube_rules
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# TARGET is the name of the output
|
# Configurable options
|
||||||
# BUILD is the directory where object files & intermediate files will be placed
|
|
||||||
# SOURCES is a list of directories containing source code
|
|
||||||
# INCLUDES is a list of directories containing extra header files
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
# Directory where object files are placed
|
||||||
|
BUILD_DIR := build/gc
|
||||||
|
# List of directories containing source code
|
||||||
|
SOURCE_DIRS := src third_party/bearssl/src
|
||||||
|
# Name of the final output
|
||||||
TARGET := ClassiCube-gc
|
TARGET := ClassiCube-gc
|
||||||
BUILD := build-gc
|
# Additional libraries to link against
|
||||||
SOURCES := src third_party/bearssl/src
|
LIBS = -lasnd -lbba -lfat -logc -lm
|
||||||
INCLUDES := third_party/bearssl/inc
|
# List of directories containing more header files
|
||||||
|
INCLUDES = -Ithird_party/bearssl/inc
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# Code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
S_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||||
|
C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||||
|
OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||||
|
CFLAGS = -g -O2 -Wall $(MACHDEP) -I$(LIBOGC_INC)
|
||||||
|
LDFLAGS = -g $(MACHDEP) -L$(LIBOGC_LIB)
|
||||||
|
|
||||||
|
# Dependency tracking
|
||||||
|
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||||
|
DEPFILES := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
|
||||||
CXXFLAGS = $(CFLAGS)
|
|
||||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with the project
|
# Main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBS := -lasnd -lbba -lfat -logc -lm
|
default: $(BUILD_DIR) $(TARGET).dol
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# automatically build a list of object files for our project
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
|
||||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
|
||||||
|
|
||||||
export LD := $(CC)
|
|
||||||
|
|
||||||
export OFILES := $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# build a list of include paths
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
-I$(CURDIR)/$(BUILD) \
|
|
||||||
-I$(LIBOGC_INC)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# build a list of library paths
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LIBPATHS := -L$(LIBOGC_LIB)
|
|
||||||
|
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
all: $(BUILD)
|
|
||||||
$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/misc/gc/Makefile
|
|
||||||
|
|
||||||
$(BUILD):
|
|
||||||
mkdir -p $@
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
clean:
|
||||||
echo clean ...
|
rm $(TARGET).dol $(TARGET).elf $(OBJS)
|
||||||
rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
else
|
# Executable generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(TARGET).elf: $(OBJS)
|
||||||
|
$(CC) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(TARGET).dol: $(TARGET).elf
|
||||||
|
elf2dol $< $@
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# Object generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(OUTPUT).dol: $(OUTPUT).elf
|
$(BUILD_DIR)/%.o: src/%.c
|
||||||
$(OUTPUT).elf: $(OFILES)
|
$(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
||||||
|
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
endif
|
# Dependency tracking
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
$(DEPFILES):
|
||||||
|
|
||||||
|
include $(wildcard $(DEPFILES))
|
||||||
|
@ -13,9 +13,7 @@ include $(DEVKITPRO)/libnx/switch_rules
|
|||||||
# TARGET is the name of the output
|
# TARGET is the name of the output
|
||||||
# BUILD is the directory where object files & intermediate files will be placed
|
# BUILD is the directory where object files & intermediate files will be placed
|
||||||
# SOURCES is a list of directories containing source code
|
# SOURCES is a list of directories containing source code
|
||||||
# DATA is a list of directories containing data files
|
|
||||||
# INCLUDES is a list of directories containing header files
|
# INCLUDES is a list of directories containing header files
|
||||||
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
|
|
||||||
#
|
#
|
||||||
# NO_ICON: if set to anything, do not use icon.
|
# NO_ICON: if set to anything, do not use icon.
|
||||||
# NO_NACP: if set to anything, no .nacp file is generated.
|
# NO_NACP: if set to anything, no .nacp file is generated.
|
||||||
@ -29,24 +27,15 @@ include $(DEVKITPRO)/libnx/switch_rules
|
|||||||
# - icon.jpg
|
# - icon.jpg
|
||||||
# - <libnx folder>/default_icon.jpg
|
# - <libnx folder>/default_icon.jpg
|
||||||
#
|
#
|
||||||
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
|
|
||||||
# If not set, it attempts to use one of the following (in this order):
|
|
||||||
# - <Project name>.json
|
|
||||||
# - config.json
|
|
||||||
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
|
|
||||||
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
|
|
||||||
# NACP building is skipped as well.
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := ClassiCube-switch
|
TARGET := ClassiCube-switch
|
||||||
BUILD := build-switch
|
BUILD := build-switch
|
||||||
SOURCES := src misc/switch third_party/bearssl/src
|
SOURCES := src misc/switch third_party/bearssl/src
|
||||||
DATA := data
|
|
||||||
INCLUDES := third_party/bearssl/inc
|
INCLUDES := third_party/bearssl/inc
|
||||||
#ROMFS := romfs
|
|
||||||
|
|
||||||
APP_TITLE := ClassiCube
|
APP_TITLE := ClassiCube
|
||||||
APP_AUTHOR := ClassiCube team
|
APP_AUTHOR := ClassiCube team
|
||||||
ICON := misc/switch/icon.jpg
|
APP_ICON := misc/switch/icon.jpg
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
@ -82,20 +71,15 @@ ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
export TOPDIR := $(CURDIR)
|
export TOPDIR := $(CURDIR)
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
|
||||||
export LD := $(CXX)
|
export LD := $(CXX)
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
export OFILES := $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
export OFILES_SRC := $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
@ -103,35 +87,7 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||||
|
|
||||||
ifeq ($(strip $(CONFIG_JSON)),)
|
export NROFLAGS += --icon=$(APP_ICON)
|
||||||
jsons := $(wildcard *.json)
|
|
||||||
ifneq (,$(findstring $(TARGET).json,$(jsons)))
|
|
||||||
export APP_JSON := $(TOPDIR)/$(TARGET).json
|
|
||||||
else
|
|
||||||
ifneq (,$(findstring config.json,$(jsons)))
|
|
||||||
export APP_JSON := $(TOPDIR)/config.json
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
icons := $(wildcard *.jpg)
|
|
||||||
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
|
|
||||||
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
|
|
||||||
else
|
|
||||||
ifneq (,$(findstring icon.jpg,$(icons)))
|
|
||||||
export APP_ICON := $(TOPDIR)/icon.jpg
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
export APP_ICON := $(TOPDIR)/$(ICON)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $(NO_ICON)),)
|
|
||||||
export NROFLAGS += --icon=$(APP_ICON)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $(NO_NACP)),)
|
ifeq ($(strip $(NO_NACP)),)
|
||||||
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
|
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
|
||||||
@ -141,10 +97,6 @@ ifneq ($(APP_TITLEID),)
|
|||||||
export NACPFLAGS += --titleid=$(APP_TITLEID)
|
export NACPFLAGS += --titleid=$(APP_TITLEID)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(ROMFS),)
|
|
||||||
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean all
|
.PHONY: $(BUILD) clean all
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -157,11 +109,7 @@ $(BUILD):
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
clean:
|
clean:
|
||||||
@echo clean ...
|
@echo clean ...
|
||||||
ifeq ($(strip $(APP_JSON)),)
|
|
||||||
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
|
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
|
||||||
else
|
|
||||||
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -173,8 +121,6 @@ DEPENDS := $(OFILES:.o=.d)
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
ifeq ($(strip $(APP_JSON)),)
|
|
||||||
|
|
||||||
all : $(OUTPUT).nro
|
all : $(OUTPUT).nro
|
||||||
|
|
||||||
ifeq ($(strip $(NO_NACP)),)
|
ifeq ($(strip $(NO_NACP)),)
|
||||||
@ -183,28 +129,10 @@ else
|
|||||||
$(OUTPUT).nro : $(OUTPUT).elf
|
$(OUTPUT).nro : $(OUTPUT).elf
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
all : $(OUTPUT).nsp
|
|
||||||
|
|
||||||
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
|
|
||||||
|
|
||||||
$(OUTPUT).nso : $(OUTPUT).elf
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h : %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
|
@ -1,103 +1,74 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Clear the implicit built in rules
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
.SECONDARY:
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITPPC)),)
|
ifeq ($(strip $(DEVKITPPC)),)
|
||||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(DEVKITPPC)/wii_rules
|
include $(DEVKITPPC)/wii_rules
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# TARGET is the name of the output
|
# Configurable options
|
||||||
# BUILD is the directory where object files & intermediate files will be placed
|
|
||||||
# SOURCES is a list of directories containing source code
|
|
||||||
# INCLUDES is a list of directories containing extra header files
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
# Directory where object files are placed
|
||||||
|
BUILD_DIR := build/wii
|
||||||
|
# List of directories containing source code
|
||||||
|
SOURCE_DIRS := src third_party/bearssl/src
|
||||||
|
# Name of the final output
|
||||||
TARGET := ClassiCube-wii
|
TARGET := ClassiCube-wii
|
||||||
BUILD := build-wii
|
# Additional libraries to link against
|
||||||
SOURCES := src third_party/bearssl/src
|
LIBS = -lasnd -lwiikeyboard -lwiiuse -lbte -lfat -logc -lm
|
||||||
INCLUDES := third_party/bearssl/inc
|
# List of directories containing more header files
|
||||||
|
INCLUDES = -Ithird_party/bearssl/inc
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# Code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
S_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||||
|
C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||||
|
OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||||
|
CFLAGS = -g -O2 -Wall $(MACHDEP) -I$(LIBOGC_INC)
|
||||||
|
LDFLAGS = -g $(MACHDEP) -L$(LIBOGC_LIB)
|
||||||
|
|
||||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
# Dependency tracking
|
||||||
CXXFLAGS = $(CFLAGS)
|
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||||
|
DEPFILES := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# any extra libraries we wish to link with the project
|
# Main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBS := -lasnd -lwiikeyboard -lwiiuse -lbte -lfat -logc -lm
|
default: $(BUILD_DIR) $(TARGET).dol
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
|
|
||||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# automatically build a list of object files for our project
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
|
||||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
|
||||||
|
|
||||||
export LD := $(CC)
|
|
||||||
|
|
||||||
export OFILES := $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# build a list of include paths
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
-I$(CURDIR)/$(BUILD) \
|
|
||||||
-I$(LIBOGC_INC)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# build a list of library paths
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LIBPATHS := -L$(LIBOGC_LIB)
|
|
||||||
|
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
all: $(BUILD)
|
|
||||||
$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/misc/wii/Makefile
|
|
||||||
|
|
||||||
$(BUILD):
|
|
||||||
mkdir -p $@
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
clean:
|
||||||
echo clean ...
|
rm $(TARGET).dol $(TARGET).elf $(OBJS)
|
||||||
rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
else
|
# Executable generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(TARGET).elf: $(OBJS)
|
||||||
|
$(CC) $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||||
|
|
||||||
|
$(TARGET).dol: $(TARGET).elf
|
||||||
|
elf2dol $< $@
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# Object generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(OUTPUT).dol: $(OUTPUT).elf
|
$(BUILD_DIR)/%.o: src/%.c
|
||||||
$(OUTPUT).elf: $(OFILES)
|
$(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
||||||
|
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
endif
|
# Dependency tracking
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
$(DEPFILES):
|
||||||
|
|
||||||
|
include $(wildcard $(DEPFILES))
|
||||||
|
@ -437,7 +437,7 @@ static int _argc;
|
|||||||
static char** _argv;
|
static char** _argv;
|
||||||
|
|
||||||
/* webclient does some asynchronous initialisation first, then kickstarts the game after that */
|
/* webclient does some asynchronous initialisation first, then kickstarts the game after that */
|
||||||
static void web_main(int argc, char** argv) {
|
static void web_main(void) {
|
||||||
SetupProgram(_argc, _argv);
|
SetupProgram(_argc, _argv);
|
||||||
cc_result res = RunProgram(_argc, _argv);
|
cc_result res = RunProgram(_argc, _argv);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user