[327] | 1 | ###############################################################################
|
---|
| 2 | # Makefile to build BIOS Drive Information Tool. #
|
---|
| 3 | # #
|
---|
| 4 | # Valid makefile targets are: #
|
---|
| 5 | # all Removes existing files and builds binary file in \Build #
|
---|
| 6 | # clean Removes all files from \Build #
|
---|
| 7 | # #
|
---|
| 8 | # Build directory must be created manually if it does not exist. #
|
---|
| 9 | # #
|
---|
| 10 | ###############################################################################
|
---|
| 11 |
|
---|
| 12 | ###########################################
|
---|
| 13 | # Source files and destination executable #
|
---|
| 14 | ###########################################
|
---|
| 15 |
|
---|
| 16 | # Assembly source code file (*.asm):
|
---|
| 17 | SRC_ASM = Src/Main.asm
|
---|
| 18 |
|
---|
| 19 | # Program executable file name without extension:
|
---|
| 20 | PROG = biosdrvs
|
---|
| 21 | EXTENSION = com
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | #######################################
|
---|
| 25 | # Destination and include directories #
|
---|
| 26 | #######################################
|
---|
| 27 |
|
---|
| 28 | # Directory where binary file will be compiled to
|
---|
| 29 | BUILD_DIR = Build
|
---|
| 30 |
|
---|
| 31 | # Subdirectories where included files are:
|
---|
| 32 | HEADERS = Inc/
|
---|
| 33 | HEADERS += Src/
|
---|
| 34 |
|
---|
| 35 | # Subdirectories where library files are:
|
---|
| 36 | LIBS = ../Assembly_Library/Inc/
|
---|
| 37 | LIBS += ../Assembly_Library/Src/
|
---|
| 38 | LIBS += ../Assembly_Library/Src/Display/
|
---|
| 39 | LIBS += ../Assembly_Library/Src/File/
|
---|
| 40 | LIBS += ../Assembly_Library/Src/Keyboard/
|
---|
| 41 | LIBS += ../Assembly_Library/Src/Menu/
|
---|
| 42 | LIBS += ../Assembly_Library/Src/Menu/Dialog/
|
---|
| 43 | LIBS += ../Assembly_Library/Src/String/
|
---|
| 44 | LIBS += ../Assembly_Library/Src/Time/
|
---|
| 45 | LIBS += ../Assembly_Library/Src/Util/
|
---|
| 46 | LIBS += ../XTIDE_Universal_BIOS/Inc/
|
---|
[613] | 47 | LIBS += ../XTIDE_Universal_BIOS/Src/Initialization/
|
---|
[359] | 48 | LIBS += ../XTIDE_Universal_BIOS/Src/VariablesAndDPTs/
|
---|
[327] | 49 | HEADERS += $(LIBS)
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | #################################################################
|
---|
| 53 | # Assembler preprocessor defines. #
|
---|
| 54 | #################################################################
|
---|
[592] | 55 | DEFINES = EXCLUDE_FROM_BIOSDRVS
|
---|
[327] | 56 | DEFINES_XT = ELIMINATE_CGA_SNOW
|
---|
| 57 | DEFINES_XTPLUS = USE_186 ELIMINATE_CGA_SNOW
|
---|
| 58 | DEFINES_AT = USE_286 USE_AT
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | ###################
|
---|
| 62 | # Other variables #
|
---|
| 63 | ###################
|
---|
| 64 |
|
---|
| 65 | # Add -D in front of every preprocessor define declaration
|
---|
| 66 | DEFS = $(DEFINES:%=-D%)
|
---|
| 67 | DEFS_XT = $(DEFINES_XT:%=-D%)
|
---|
| 68 | DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%)
|
---|
| 69 | DEFS_AT = $(DEFINES_AT:%=-D%)
|
---|
| 70 |
|
---|
| 71 | # Add -I in front of all header directories
|
---|
| 72 | IHEADERS = $(HEADERS:%=-I%)
|
---|
| 73 |
|
---|
| 74 | # Path + target file to be built
|
---|
| 75 | TARGET = $(BUILD_DIR)/$(PROG)
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | #########################
|
---|
| 79 | # Compilers and linkers #
|
---|
| 80 | #########################
|
---|
| 81 |
|
---|
| 82 | # Make
|
---|
| 83 | MAKE = mingw32-make.exe
|
---|
| 84 |
|
---|
| 85 | # Assembler
|
---|
| 86 | AS = nasm.exe
|
---|
| 87 |
|
---|
| 88 | # use this command to erase files.
|
---|
| 89 | RM = -del /Q
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | #############################
|
---|
| 93 | # Compiler and linker flags #
|
---|
| 94 | #############################
|
---|
| 95 |
|
---|
| 96 | # Assembly compiler flags
|
---|
| 97 | ASFLAGS = -f bin # Produce binary object files
|
---|
| 98 | ASFLAGS += $(DEFS) # Preprocessor defines
|
---|
| 99 | ASFLAGS += $(IHEADERS) # Set header file directory paths
|
---|
| 100 | ASFLAGS += -Worphan-labels # Warn about labels without colon
|
---|
[592] | 101 | ASFLAGS += -Ox # Optimize operands to their shortest forms
|
---|
[327] | 102 |
|
---|
| 103 |
|
---|
| 104 | ############################################
|
---|
| 105 | # Build process. Actual work is done here. #
|
---|
| 106 | ############################################
|
---|
| 107 |
|
---|
| 108 | .PHONY: all at xtplus xt clean release
|
---|
| 109 |
|
---|
| 110 | all: clean xt
|
---|
| 111 | @echo All done!
|
---|
| 112 |
|
---|
| 113 | at:
|
---|
| 114 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.$(EXTENSION)"
|
---|
| 115 | @echo AT version "$(TARGET)_at.$(EXTENSION)" built.
|
---|
| 116 |
|
---|
| 117 | xtplus:
|
---|
| 118 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.$(EXTENSION)"
|
---|
| 119 | @echo XT Plus version "$(TARGET)_xtp.$(EXTENSION)" built.
|
---|
| 120 |
|
---|
| 121 | xt:
|
---|
| 122 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET).$(EXTENSION)"
|
---|
| 123 | @echo XT version "$(TARGET).$(EXTENSION)" built.
|
---|
| 124 |
|
---|
| 125 | clean:
|
---|
| 126 | @$(RM) $(BUILD_DIR)\*.*
|
---|
| 127 | @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
|
---|
| 128 |
|
---|
| 129 | release: xt
|
---|
| 130 | @echo Compressing with UPX...
|
---|
| 131 | @upx -qq --8086 --ultra-brute $(TARGET).$(EXTENSION)
|
---|
| 132 | @echo Done! XT version is ready for release.
|
---|
[592] | 133 |
|
---|
| 134 | xt_unused: xt
|
---|
| 135 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
| 136 | @perl ..\Tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
|
---|
| 137 |
|
---|