mirror of
				https://gitlab.com/octospacc/MultiSpaccSDK
				synced 2025-06-05 22:09:21 +02:00 
			
		
		
		
	Crappy method for NDS building (should fix if the option exists)
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,3 +1,5 @@ | ||||
| *.o | ||||
| *.exe | ||||
| *.run | ||||
| *.tmp | ||||
| Build/* | ||||
|   | ||||
| @@ -30,31 +30,57 @@ ifeq ($(MultiSpacc_Target), SDL12) | ||||
| 	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) | ||||
| 	BuildProcess = Normal | ||||
| else ifeq ($(MultiSpacc_Target), SDL20) | ||||
| 	Defines += -DMultiSpacc_Target_SDL20 | ||||
| 	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) | ||||
| 	BuildProcess = Normal | ||||
| else ifeq ($(MultiSpacc_Target), NDS) | ||||
| 	#include $(DEVKITARM)/ds_rules | ||||
| 	Defines += -DMultiSpacc_Target_NDS | ||||
| 	CFlags += -I$(DEVKITPRO)/libnds/include -DARM9 | ||||
| 	Sources += $(wildcard ../../LibMultiSpacc/NDS/*.c) | ||||
| 	ToolsPrefix = $(DEVKITARM)/bin/arm-none-eabi- | ||||
| 	BuildProcess = NDS | ||||
| endif | ||||
|  | ||||
| CC = $(ToolsPrefix)gcc $(CFlags) $(Defines) | ||||
| Objects = $(Sources:.c=.o) | ||||
|  | ||||
| All all: $(AppName) | ||||
| All all: $(BuildProcess) | ||||
|  | ||||
| $(AppName): $(Objects) | ||||
| Normal: $(Objects) | ||||
| 	$(CC) $^ $(LdFlags) -o $(AppName)$(ExeSuffix) | ||||
|  | ||||
| NDS: | ||||
| 	#mkdir -p ./Build/NDS/Examples | ||||
| 	#cp -rT . ./Build/NDS/Examples/$(shell basename $(CURDIR)) || true | ||||
| 	#rm -rf ./Build/NDS/Examples/$(shell basename $(CURDIR))/Build | ||||
| 	#cp -rT ../../LibMultiSpacc ./Build/NDS/LibMultiSpacc | ||||
| 	#cp ../NDS.mk ./Build/NDS/Examples/$(shell basename $(CURDIR))/Makefile | ||||
| 	#ln -s $(wildcard ../../LibMultiSpacc/*.* ../../LibMultiSpacc/NDS/*.*) ./Build/NDS/Examples/$(shell basename $(CURDIR))/ | ||||
| 	#cd ./Build/NDS/Examples/$(shell basename $(CURDIR)); make | ||||
| 	#$(eval VirtualBuildDir = ./Build/NDS/$(shell basename $(CURDIR))) | ||||
| 	#mkdir -p $(VirtualBuildDir)/source/LibMultiSpacc | ||||
| 	$(eval VirtualBuildDir = ./Build/NDS) | ||||
| 	mkdir -p $(VirtualBuildDir)/source/.tmp | ||||
| 	cp ../NDS.mk $(VirtualBuildDir)/Makefile | ||||
| 	#cp $(wildcard *) $(VirtualBuildDir)/source/ | ||||
| 	#cp $(Sources) $(wildcard ../../LibMultiSpacc/*.* ../../LibMultiSpacc/NDS/*.*) $(VirtualBuildDir)/source/ | ||||
| 	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 | ||||
| 	#cp -rT ../../LibMultiSpacc $(VirtualBuildDir)/source/LibMultiSpacc | ||||
| 	for i in $(VirtualBuildDir)/source/*; do sed -i 's|"../../LibMultiSpacc/|"LibMultiSpacc_|g' $$i; done | ||||
| 	for i in $(VirtualBuildDir)/source/*; do sed -i 's|"../MultiSpacc|"LibMultiSpacc_MultiSpacc|g' $$i; done | ||||
| 	for i in $(VirtualBuildDir)/source/*; do sed -i 's|"NDS/|"LibMultiSpacc_NDS_|g' $$i; done | ||||
| 	cd $(VirtualBuildDir); make | ||||
|  | ||||
| Run run: All | ||||
| 	./$(AppName)$(ExeSuffix) | ||||
|  | ||||
| Clean clean: | ||||
| Clean clean Clear clear: | ||||
| 	find -L . -name "*.o" -type f -delete | ||||
| 	find -L ../../LibMultiSpacc -name "*.o" -type f -delete | ||||
| 	rm -f $(AppName)$(ExeSuffix) $(AppName).*$(ExeSuffix) | ||||
| 	rm -f ./$(AppName)$(ExeSuffix) ./$(AppName).*$(ExeSuffix) | ||||
| 	rm -rf ./Build | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -18,9 +18,9 @@ int main( int argc, char *args[] ) | ||||
|  | ||||
| 	// Bitmap font borrowed from: <https://github.com/nesdoug/01_Hello/blob/master/Alpha.chr> | ||||
| 	// Copyright (c) 2018 Doug Fraker www.nesdoug.com (MIT) | ||||
| 	MultiSpacc_Surface *TilesImg = MultiSpacc_LoadImage( "Tiles.png", Screen, NULL ); | ||||
| 	//MultiSpacc_Surface *TilesImg = MultiSpacc_LoadImage( "Tiles.png", Screen, NULL ); | ||||
|  | ||||
| 	MultiSpacc_PrintText( "Hello, World!", Screen, WindowConfig.Width, WindowConfig.Height, 4, 4, TilesImg ); | ||||
| 	//MultiSpacc_PrintText( "Hello, World!", Screen, WindowConfig.Width, WindowConfig.Height, 4, 4, TilesImg ); | ||||
|  | ||||
| 	if( MultiSpacc_UpdateWindowSurface( Window ) != 0 ) | ||||
| 	{ | ||||
|   | ||||
							
								
								
									
										125
									
								
								LibMultiSpacc/Examples/NDS.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								LibMultiSpacc/Examples/NDS.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,125 @@ | ||||
| #--------------------------------------------------------------------------------- | ||||
| .SUFFIXES: | ||||
| #--------------------------------------------------------------------------------- | ||||
|  | ||||
| ifeq ($(strip $(DEVKITARM)),) | ||||
| $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") | ||||
| endif | ||||
|  | ||||
| include $(DEVKITARM)/ds_rules | ||||
|  | ||||
| #--------------------------------------------------------------------------------- | ||||
| # TARGET is the name of the output | ||||
| # 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 | ||||
| #--------------------------------------------------------------------------------- | ||||
| TARGET		:=	$(shell basename $(abspath $(CURDIR)/../..)) | ||||
| BUILD		:=	build | ||||
| SOURCES		:=	gfx source data source/LibMultiSpacc source/LibMultiSpacc/NDS | ||||
| INCLUDES	:=	include build | ||||
|  | ||||
| #--------------------------------------------------------------------------------- | ||||
| # options for code generation | ||||
| #--------------------------------------------------------------------------------- | ||||
| ARCH	:=	-mthumb -mthumb-interwork | ||||
|  | ||||
| CFLAGS	:=	-g -Wall -O2\ | ||||
|  			-march=armv5te -mtune=arm946e-s -fomit-frame-pointer\ | ||||
| 			-ffast-math \ | ||||
| 			$(ARCH) | ||||
|  | ||||
| CFLAGS	+=	$(INCLUDE) -DARM9 -DMultiSpacc_Target_NDS | ||||
| CXXFLAGS	:= $(CFLAGS) -fno-rtti -fno-exceptions | ||||
|  | ||||
| ASFLAGS	:=	-g $(ARCH) | ||||
| 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) | ||||
|  | ||||
| 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 | ||||
| #--------------------------------------------------------------------------------- | ||||
| ifeq ($(strip $(CPPFILES)),) | ||||
| #--------------------------------------------------------------------------------- | ||||
| 	export LD	:=	$(CC) | ||||
| #--------------------------------------------------------------------------------- | ||||
| else | ||||
| #--------------------------------------------------------------------------------- | ||||
| 	export LD	:=	$(CXX) | ||||
| #--------------------------------------------------------------------------------- | ||||
| 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