Advertisement
Guest User

makefile m68k-amiga-elf-gcc w. vasm -Felf

a guest
Sep 25th, 2024
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 6.64 KB | Source Code | 0 0
  1. # to generate assembler listing with LTO, add to LDFLAGS: -Wa,[email protected],--listing-rhs-width=200
  2. # for better annotations add -dA -dP
  3. # to generate assembler source with LTO, add to LDFLAGS: -save-temps=cwd
  4.  
  5. forward-to-backward = $(subst /,\,$1)
  6.  
  7. subdirs := src/ shared/ shared/tools/ shared/image/ shared/math/ src/roots_rotator/ src/copper_stretch/ src/tunnel/ src/copper_voxel/ src/image_viewer/ src/title/ src/greetings/ src/logos/ src/wbscreen/ src/playfield/ src/end/
  8. data_subdirs := data/tunnel/
  9. VPATH = $(subdirs)
  10. cpp_sources := $(wildcard *.cpp) $(wildcard $(addsuffix *.cpp,$(subdirs)))
  11. cpp_objects := $(addprefix obj/,$(patsubst %.cpp,%.o,$(notdir $(cpp_sources))))
  12. c_sources := $(wildcard *.c) $(wildcard $(addsuffix *.c,$(subdirs)))
  13. c_objects := $(addprefix obj/,$(patsubst %.c,%.o,$(notdir $(c_sources))))
  14. s_sources := shared/tools/gcc8_a_support.s shared/tools/depacker_doynax.s src/roots_rotator/artezoom.s src/tunnel/tunnel.s
  15. s_objects := $(addprefix obj/,$(patsubst %.s,%.o,$(notdir $(s_sources))))
  16. iff_sources :=
  17. iff_objects := $(addprefix obj/,$(patsubst %.iff,%.lzw,$(notdir $(iff_sources))))
  18. vasm_sources := shared/reset.s shared/tools/wos_overlay.s src/copper_stretch/drawscanline.s src/copper_voxel/voxeldrawcolumn.s src/kpl14-mod.s src/wbscreen/coppercustom.s src/playfield/playfield_asm.s
  19. # removed from vasm_sources src/LightSpeedPlayer_cia.s
  20. vasm_objects := $(addprefix obj/,$(patsubst %.s,%.o,$(notdir $(vasm_sources))))
  21. vasm_sources_bin := src/tunnel/tunnel_routine.s
  22. vasm_objects_bin := $(patsubst %.s, %.bin, $(addprefix data/,$(vasm_sources_bin:src/%=%)))
  23. lzw_sources :=
  24. lzw_objects := $(addprefix obj/,$(patsubst %.bin,%.lzw,$(notdir $(lzw_sources))))
  25.  
  26. lzw_sources1 := data/tunnel/tunnel.bmp data/tunnel/tunnel1.bmp data/tunnel/tunnel_routine.bin data/tunnel/tab.bin data/tunnel/tab1.bin \
  27.                 data/copper_voxel/color3_256x128.bmp data/copper_voxel/height3_512x128.bmp data/copper_voxel/height3_256x128.bmp data/copper_voxel/rays-new.bin data/copper_voxel/rays_1024.bin data/copper_voxel/divtablearray-converted-180.bin data/copper_voxel/divtablearray-converted-new.bin data/copper_voxel/color3_512x128_v6.bmp data/copper_voxel/credit_1.iff data/copper_voxel/credit_2.iff data/copper_voxel/credit_3.iff data/copper_voxel/credit_4.iff data/copper_voxel/credit_5.iff \
  28.                 data/roots_rotator/arte_zoom.iff data/roots_rotator/arte_zoom_logo.iff data/roots_rotator/GodIsAnAstronaut.iff \
  29.                 data/copper_stretch/texture.bmp data/copper_stretch/credits.iff data/copper_stretch/tunnel_logo.iff \
  30.                 data/image_viewer/NeonRain.iff \
  31.                 data/title/TheLoop.iff \
  32.                 data/greetings/layer0.iff data/greetings/layer1.iff data/greetings/layer2.iff data/greetings/gradient.bmp \
  33.                 data/logos/Ghostown_logo_320x180.iff data/logos/Haujobb_logo_320x180.iff \
  34.                 data/playfield/playfields_off_v4.iff data/playfield/mask.iff \
  35.                 data/end/end_320x180.iff data/ascii.ansi
  36.                
  37. lzw_objects1 := $(addsuffix .lz,$(lzw_sources1))
  38.  
  39. objects := $(vasm_objects) $(cpp_objects) $(c_objects) $(s_objects)
  40.  
  41. # https://stackoverflow.com/questions/4036191/sources-from-subdirectories-in-makefile/4038459
  42. # http://www.microhowto.info/howto/automatically_generate_makefile_dependencies.html
  43.  
  44. OUT = a.mingw
  45. CC = m68k-amiga-elf-gcc
  46.  
  47. INCLUDES = -Ishared
  48.  
  49. SHELL = c:/windows/system32/cmd.exe
  50.  
  51. //CCFLAGS = -g -MP -MMD -m68000 -nostdlib -Wextra -Wno-unused-function -Wno-volatile-register-var -fomit-frame-pointer -fno-tree-loop-distribution -flto -fwhole-program -fno-exceptions -D__BIG_ENDIAN__ -D__LOAD_DATA__  $(INCLUDES)
  52. CCFLAGS = -g -MP -MMD -m68000 -Ofast -nostdlib -Wextra -Wno-unused-function -Wno-volatile-register-var -fomit-frame-pointer -fno-tree-loop-distribution -flto -fwhole-program -fno-exceptions -D__BIG_ENDIAN__ -D__LOAD_DATA__  $(INCLUDES)
  53. CPPFLAGS= $(CCFLAGS) -fno-rtti -fcoroutines -fno-use-cxa-atexit
  54. ASFLAGS = -Wa,-g,--register-prefix-optional
  55. LDFLAGS = -Wl,--emit-relocs,-Ttext=0,-Map=$(OUT).map
  56.  
  57.  
  58. VBCCDIR= $(realpath $(VBCC))
  59. $(info $(lzw_objects1))
  60. $(info $(VBCCDIR))
  61. $(info $(c_sources))
  62. $(info $(vasm_sources_bin))
  63. $(info $(vasm_objects_bin))
  64.  
  65. # hjb
  66. #VASM = $(VBCCDIR)/bin/vasmm68k_mot
  67. #VASMFLAGS = -m68000 -quiet -Felf -opt-speed -showopt -I$(VBCCDIR)/NDK39/Include/include_i
  68. VASM = vasmm68k_mot
  69. VASMFLAGS = -m68000 -quiet -Felf -opt-speed -showopt -I$(VBCCDIR)/NDK39/Include/include_i
  70. VASMFLAGS_ = -m68000 -Fbin -opt-speed -showopt -I$(VBCCDIR)/NDK39/Include/include_i
  71. LZW = tools/lzw.exe
  72. CRANKER = tools/cranker.exe
  73.  
  74.  
  75. $(info $(lzw_sources))
  76. $(info $(lzw_objects))
  77. $(info $(s_sources))
  78. $(info $(s_objects))
  79.  
  80. all: $(OUT).exe
  81.  
  82. $(OUT).exe: $(OUT).elf
  83.     $(info Elf2Hunk $(OUT).exe)
  84.     @elf2hunk $(OUT).elf $(OUT).exe -s
  85. # cranker release version
  86.     python whdf.py -n "The Loop Final" -f whdf-filelist.txt -a overlaydata.bin
  87.     copy /b shared\tools\ovl.bin + overlaydata.bin markedoverlaydata.bin
  88.     @$(CRANKER) -f $(OUT).exe -a markedoverlaydata.bin -tf data\cranker.txt -ed decranker_userdata.bin -o $(OUT).exe
  89.     copy $(OUT).exe loop.exe
  90. #   @$(CRANKER) -f $(OUT).exe -a markedoverlaydata.bin -tf data\ascii.ansi -ed decranker_userdata.bin -o $(OUT).exe
  91. # normal debug version 
  92. #   python whdf.py -f whdf-filelist.txt -a overlaydata.bin -e $(OUT).exe -o loop.exe   
  93. #   copy loop.exe $(OUT).exe
  94. # deprecated old approach  
  95. #   copy /b $(OUT).exe + shared\tools\ovl.bin + overlaydata.bin $(OUT).exe
  96.  
  97. $(OUT).elf: $(objects)
  98.     $(info Linking a.mingw.elf)
  99.     $(info $(objects))
  100.     @$(CC) $(CCFLAGS) $(LDFLAGS) $(objects) -o $@
  101.     @m68k-amiga-elf-objdump --disassemble --no-show-raw-ins --visualize-jumps -S $@ >$(OUT).s
  102.  
  103. clean:
  104.     $(info Cleaning...)
  105.     @del /q obj $(OUT).* 2>nul || rmdir obj 2>nul || ver>nul
  106.  
  107. -include $(objects:.o=.d)
  108.  
  109. $(iff_objects): obj/%.lzw : $(iff_sources)
  110.     $(info IFF $<)
  111.     @$(LZW) -o $@ $(CURDIR)/$<
  112.  
  113. $(cpp_objects) : obj/%.o : %.cpp $(lzw_objects) $(iff_objects)
  114.     @if not exist "$(call forward-to-backward,$(dir $@))" mkdir $(call forward-to-backward,$(dir $@))
  115.     $(info Compiling $<)
  116.     @$(CC) $(CPPFLAGS) -c -o $@ $(CURDIR)/$<
  117.  
  118. $(c_objects) : obj/%.o : %.c $(lzw_objects)
  119.     @if not exist "$(call forward-to-backward,$(dir $@))" mkdir $(call forward-to-backward,$(dir $@))
  120.     $(info Compiling $<)
  121.     @$(CC) $(CCFLAGS) -c -o $@ $(CURDIR)/$<
  122.  
  123. $(s_objects): obj/%.o : %.s
  124.     $(info Assembling $<)
  125.     @$(CC) $(CCFLAGS) $(ASFLAGS) -c -o $@ $(CURDIR)/$<
  126.  
  127. $(vasm_objects): obj/%.o : %.s
  128.     $(info Assembling (VASM) $<)
  129.     @$(VASM) $(VASMFLAGS) -o $@ $(CURDIR)/$<
  130.  
  131. data: $(vasm_objects_bin)
  132. $(vasm_objects_bin): $(vasm_sources_bin)
  133.     $(info Assembling (VASM) $< , $@)
  134.     @$(VASM) -m68000 -Fbin -opt-speed -showopt -o $@ $(CURDIR)/$<
  135.  
  136. compress: $(lzw_objects1)
  137. $(lzw_objects1):
  138.     $(info Compressing (LZW) $@ , $(basename $@))
  139.     @$(LZW) -o $@ $(basename $@)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement