mirror of
https://gitlab.com/octospacc/MultiSpaccSDK
synced 2025-06-05 22:09:21 +02:00
Restructure code in preparation for function-based hierarchy
This commit is contained in:
@ -2,6 +2,7 @@ AppName = $(notdir ${CURDIR})
|
||||
Sources = $(wildcard *.c ../../LibMultiSpacc/*.c)
|
||||
CFlags = -O2 -Wpedantic -Werror
|
||||
|
||||
# Default build is always for the host system
|
||||
ifndef Target
|
||||
ifeq ($(shell uname --operating-system), Msys)
|
||||
Target = WindowsPC
|
||||
@ -26,16 +27,16 @@ ifdef Target
|
||||
endif
|
||||
|
||||
ifeq ($(MultiSpacc_Target), SDL12)
|
||||
Defines += -DMultiSpacc_Target_SDL12
|
||||
Defines += -DMultiSpacc_Target_SDL12 -DMultiSpacc_Target_SDLCom
|
||||
CFlags += $(shell sdl-config --cflags)
|
||||
LdFlags += $(shell sdl-config --libs) -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf
|
||||
Sources += $(wildcard ../../LibMultiSpacc/SDLCom/*.c ../../LibMultiSpacc/SDL12/*.c)
|
||||
#Sources += $(wildcard ../../LibMultiSpacc/SDLCom/*.c ../../LibMultiSpacc/SDL12/*.c)
|
||||
BuildProcess = Normal
|
||||
else ifeq ($(MultiSpacc_Target), SDL20)
|
||||
Defines += -DMultiSpacc_Target_SDL20
|
||||
Defines += -DMultiSpacc_Target_SDL20 -DMultiSpacc_Target_SDLCom
|
||||
CFlags += $(shell sdl2-config --cflags)
|
||||
LdFlags += $(shell sdl2-config --libs) -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf
|
||||
Sources += $(wildcard ../../LibMultiSpacc/SDLCom/*.c ../../LibMultiSpacc/SDL20/*.c)
|
||||
#Sources += $(wildcard ../../LibMultiSpacc/SDLCom/*.c ../../LibMultiSpacc/SDL20/*.c)
|
||||
BuildProcess = Normal
|
||||
else ifeq ($(MultiSpacc_Target), NDS)
|
||||
Defines += -DMultiSpacc_Target_NDS
|
||||
@ -56,12 +57,14 @@ NDS:
|
||||
cp ../NDS.mk $(VirtualBuildDir)/Makefile
|
||||
cp $(Sources) $(VirtualBuildDir)/source/
|
||||
cp $(wildcard ../../LibMultiSpacc/*.*) $(VirtualBuildDir)/source/.tmp/
|
||||
cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv $$i ../LibMultiSpacc_$$i; done
|
||||
cp $(wildcard ../../LibMultiSpacc/NDS/*.*) $(VirtualBuildDir)/source/.tmp/
|
||||
cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv $$i ../LibMultiSpacc_NDS_$$i; done
|
||||
# rm of the last file is temporary fix for a strange file duplication bug
|
||||
cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv $$i ../LibMultiSpacc_$$i; done; rm ../MultiSpacc.c #
|
||||
#cp $(wildcard ../../LibMultiSpacc/NDS/*.*) $(VirtualBuildDir)/source/.tmp/
|
||||
#cd $(VirtualBuildDir)/source/.tmp; for i in *; do mv $$i ../LibMultiSpacc_NDS_$$i; done
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"../../LibMultiSpacc/|#include "LibMultiSpacc_|g' $$i; done
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"../MultiSpacc|#include "LibMultiSpacc_MultiSpacc|g' $$i; done
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"NDS/|#include "LibMultiSpacc_NDS_|g' $$i; done
|
||||
for i in $(VirtualBuildDir)/source/*; do sed -i 's|#include[ \t]"./|#include "./LibMultiSpacc_|g' $$i; done
|
||||
cd $(VirtualBuildDir); make
|
||||
|
||||
Run run: All
|
||||
|
@ -1,3 +1,6 @@
|
||||
# This Makefile is borrowed from devkitPro's nds-examples
|
||||
# <https://github.com/devkitPro/nds-examples>
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -39,23 +42,22 @@ LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lnds9
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(LIBNDS)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# 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)
|
||||
|
||||
@ -63,7 +65,7 @@ CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
BINFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.bin)))
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -80,46 +82,44 @@ endif
|
||||
|
||||
export OFILES := $(BINFILES:.bin=.o) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||
|
||||
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(TARGET).ds.gba
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).nds : $(OUTPUT).elf
|
||||
$(OUTPUT).elf : $(OFILES)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
%.o : %.bin
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user