Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. FileName := VIDEO
  2. CC := MASM.EXE
  3. LD := LINK.EXE
  4. GDB := TD.EXE
  5. DISC_INSTRUMENTS := A:
  6. DISC_BUILDS := B:
  7. DISC_OUTPUT := C:
  8. CurrentDir := $(shell pwd -P)
  9. FullPathOutPut_TTY := $(shell tty)
  10. OutPutFile_TTY := $(shell basename ${FullPathOutPut_TTY})
  11. OutPutDir_TTY := $(FullPathOutPut_TTY:%/$(OutPutFile_TTY)=%)
  12. ASM_DIR := $(CurrentDir:%=%/bin)
  13. BUILD_DIR := $(CurrentDir:%=%/build)
  14. SRC_DIR := $(CurrentDir:%=%/src)
  15. OBJ := ${FileName:%=%.OBJ}
  16. SRC := ${FileName:%=%.ASM}
  17. all: compile_and_exit
  18. compile_and_exit: check_build
  19. cp $(SRC_DIR)/$(SRC) $(BUILD_DIR)/$(SRC)
  20. dosbox \
  21. -c "mount $(DISC_INSTRUMENTS) $(ASM_DIR)" \
  22. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  23. -c "mount $(DISC_OUTPUT) $(OutPutDir_TTY)" \
  24. -c "$(DISC_BUILDS)" \
  25. -c "PATH $(DISC_INSTRUMENTS)/" \
  26. -c "$(CC) $(SRC),,,,, >>$(DISC_OUTPUT)/$(OutPutFile_TTY)"\
  27. -c "$(LD) $(OBJ),,,,, >>$(DISC_OUTPUT)/$(OutPutFile_TTY)"\
  28. -c exit >> /dev/null
  29. rm $(BUILD_DIR)/$(FileName).{OBJ,ASM,MAP,LST,CRF}
  30. compile_without_exit: check_build
  31. cp $(SRC_DIR)/$(SRC) $(BUILD_DIR)/$(SRC)
  32. dosbox \
  33. -c "mount $(DISC_INSTRUMENTS) $(ASM_DIR)" \
  34. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  35. -c "mount $(DISC_OUTPUT) $(OutPutDir_TTY)" \
  36. -c "$(DISC_BUILDS)" \
  37. -c "PATH $(DISC_INSTRUMENTS)/" \
  38. -c "$(CC) $(SRC),,,,, " \
  39. -c "$(LD) $(OBJ),,,,, " \
  40. >> /dev/null
  41. rm $(BUILD_DIR)/$(FileName).{OBJ,ASM,MAP,LST,CRF}
  42. run: $(BUILD_DIR)/$(FileName).EXE
  43. dosbox \
  44. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  45. -c "mount $(DISC_OUTPUT) $(OutPutDir_TTY)" \
  46. -c "PATH $(DISC_BUILDS)/" \
  47. -c "$(FileName).EXE >>$(DISC_OUTPUT)/$(OutPutFile_TTY)" \
  48. -c exit >> /dev/null
  49. gdb: $(BUILD_DIR)/$(FileName).EXE
  50. dosbox \
  51. -c "mount $(DISC_INSTRUMENTS) $(ASM_DIR)" \
  52. -c "mount $(DISC_BUILDS) $(BUILD_DIR)" \
  53. -c "$(DISC_BUILDS)" \
  54. -c "PATH $(DISC_INSTRUMENTS)/;$(DISC_BUILDS)/" \
  55. -c "$(GDB) $(FileName).EXE" \
  56. -c exit >> /dev/null
  57. clear: $(BUILD_DIR)/$(FileName).EXE
  58. rm -r $<
  59. check_build:
  60. if [ ! -d "$(BUILD_DIR)" ]; then mkdir $(BUILD_DIR); fi