Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. FileName := STACK_FRAME
  2. BFileSource := IN.ASM
  3. BFileExe := IN.EXE
  4. CC := ML.EXE
  5. LD := ML.EXE
  6. GDB := CV.EXE
  7. DISC_INSTRUMENTS := A:
  8. DISC_BUILDS := B:
  9. DISC_OUTPUT := C:
  10. CurrentDir := $(shell pwd -P)
  11. FullPathOutPut_TTY := $(shell tty)
  12. OutPutFile_TTY := $(shell basename ${FullPathOutPut_TTY})
  13. OutPutDir_TTY := $(FullPathOutPut_TTY:%/$(OutPutFile_TTY)=%)
  14. FullPathOutPut_FILE := $(CurrentDir)/OUT
  15. OutPutFile_FILE := $(shell basename ${FullPathOutPut_FILE})
  16. OutPutDir_FILE := $(FullPathOutPut_FILE:%/$(OutPutFile_FILE)=%)
  17. ASM_DIR := ~/.local/opt/dosbox-masm/C/MASM611/BIN/
  18. BUILD_DIR := $(CurrentDir:%=%/build)
  19. SRC_DIR := $(CurrentDir:%=%/src)
  20. OBJ := ${FileName:%=%.OBJ}
  21. SRC := ${FileName:%=%.ASM}
  22. FileType := .EXE
  23. OUT := $(DISC_OUTPUT)/$(OutPutFile_TTY)
  24. OUT_FILE := $(DISC_OUTPUT)/$(OutPutFile_FILE)
  25. all: compile_and_exit_out_in_file
  26. compile_and_exit_out_in_file: check_build
  27. cp $(SRC_DIR)/$(SRC) $(BUILD_DIR)/$(BFileSource)
  28. dosbox \
  29. -c "mount $(DISC_INSTRUMENTS) $(ASM_DIR)" \
  30. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  31. -c "mount $(DISC_OUTPUT) $(OutPutDir_FILE)" \
  32. -c "$(DISC_BUILDS)" \
  33. -c "PATH $(DISC_INSTRUMENTS)/" \
  34. -c "$(CC) $(BFileSource) >>$(OUT_FILE)"\
  35. -c exit >> /dev/null
  36. cat $(FullPathOutPut_FILE)
  37. rm $(FullPathOutPut_FILE) $(BUILD_DIR)/$(BFileSource)
  38. compile_and_exit: check_build
  39. cp $(SRC_DIR)/$(SRC) $(BUILD_DIR)/$(BFileSource)
  40. dosbox \
  41. -c "mount $(DISC_INSTRUMENTS) $(ASM_DIR)" \
  42. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  43. -c "mount $(DISC_OUTPUT) $(OutPutDir_TTY)" \
  44. -c "$(DISC_BUILDS)" \
  45. -c "PATH $(DISC_INSTRUMENTS)/" \
  46. -c "$(CC) $(SRC) >>$(OUT)"\
  47. -c exit >> /dev/null
  48. compile_without_exit: check_build
  49. cp $(SRC_DIR)/$(SRC) $(BUILD_DIR)/$(BFileSource)
  50. dosbox \
  51. -c "mount $(DISC_INSTRUMENTS) $(ASM_DIR)" \
  52. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  53. -c "mount $(DISC_OUTPUT) $(OutPutDir_TTY)" \
  54. -c "$(DISC_BUILDS)" \
  55. -c "PATH $(DISC_INSTRUMENTS)/" \
  56. -c "$(CC) $(BFileSource)" \
  57. >> /dev/null
  58. rm $(FullPathOutPut_FILE) $(BUILD_DIR)/$(BFileSource)
  59. run: run_out_in_file
  60. run_out_in_file: $(BUILD_DIR)/$(BFileExe)
  61. dosbox \
  62. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  63. -c "mount $(DISC_OUTPUT) $(OutPutDir_FILE)" \
  64. -c "PATH $(DISC_BUILDS)/" \
  65. -c "$(BFileExe) >>$(OUT_FILE)" \
  66. -c exit >> /dev/null
  67. cat $(FullPathOutPut_FILE)
  68. wc -l $(FullPathOutPut_FILE)
  69. rm $(FullPathOutPut_FILE)
  70. run_out_in_tty: $(BUILD_DIR)/$(BFileExe)
  71. dosbox \
  72. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  73. -c "mount $(DISC_OUTPUT) $(OutPutDir_TTY)" \
  74. -c "PATH $(DISC_BUILDS)/" \
  75. -c "$(BFileExe) >>$(OUT)" \
  76. -c exit >> /dev/null
  77. gdb: $(BUILD_DIR)/$(BFileExe)
  78. dosbox \
  79. -c "mount $(DISC_INSTRUMENTS) $(ASM_DIR)" \
  80. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  81. -c "$(DISC_BUILDS)" \
  82. -c "PATH $(DISC_INSTRUMENTS)/;$(DISC_BUILDS)/" \
  83. -c "$(GDB) $(BFileExe)" \
  84. -c exit >> /dev/null
  85. clear:
  86. rm -fr $(BUILD_DIR)/$(BFileExe)
  87. check_build:
  88. if [ ! -d "$(BUILD_DIR)" ]; then mkdir $(BUILD_DIR); fi