[57] | 1 | ###############################################################################
|
---|
[293] | 2 | # Makefile to build XTIDE Universal BIOS Configurator v2. #
|
---|
[57] | 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 = xtidecfg
|
---|
| 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/
|
---|
[68] | 33 | HEADERS += Inc/Help/
|
---|
[57] | 34 | HEADERS += Src/
|
---|
| 35 | HEADERS += Src/Menupages/
|
---|
| 36 |
|
---|
| 37 | # Subdirectories where library files are:
|
---|
[59] | 38 | LIBS = ../Assembly_Library/Inc/
|
---|
| 39 | LIBS += ../Assembly_Library/Src/
|
---|
| 40 | LIBS += ../Assembly_Library/Src/Display/
|
---|
| 41 | LIBS += ../Assembly_Library/Src/File/
|
---|
| 42 | LIBS += ../Assembly_Library/Src/Keyboard/
|
---|
| 43 | LIBS += ../Assembly_Library/Src/Menu/
|
---|
| 44 | LIBS += ../Assembly_Library/Src/Menu/Dialog/
|
---|
| 45 | LIBS += ../Assembly_Library/Src/String/
|
---|
| 46 | LIBS += ../Assembly_Library/Src/Time/
|
---|
| 47 | LIBS += ../Assembly_Library/Src/Util/
|
---|
[57] | 48 | LIBS += ../XTIDE_Universal_BIOS/Inc/
|
---|
[481] | 49 | LIBS += ../XTIDE_Universal_BIOS/Inc/Controllers/
|
---|
[57] | 50 | HEADERS += $(LIBS)
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | #################################################################
|
---|
| 54 | # Assembler preprocessor defines. #
|
---|
| 55 | #################################################################
|
---|
[181] | 56 | DEFINES = EXCLUDE_FROM_XTIDECFG
|
---|
[57] | 57 | DEFINES_XT = ELIMINATE_CGA_SNOW
|
---|
| 58 | DEFINES_XTPLUS = USE_186 ELIMINATE_CGA_SNOW
|
---|
[293] | 59 | DEFINES_AT = USE_286 USE_AT
|
---|
[57] | 60 |
|
---|
| 61 |
|
---|
| 62 | ###################
|
---|
| 63 | # Other variables #
|
---|
| 64 | ###################
|
---|
| 65 |
|
---|
| 66 | # Add -D in front of every preprocessor define declaration
|
---|
| 67 | DEFS = $(DEFINES:%=-D%)
|
---|
| 68 | DEFS_XT = $(DEFINES_XT:%=-D%)
|
---|
| 69 | DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%)
|
---|
| 70 | DEFS_AT = $(DEFINES_AT:%=-D%)
|
---|
| 71 |
|
---|
| 72 | # Add -I in front of all header directories
|
---|
| 73 | IHEADERS = $(HEADERS:%=-I%)
|
---|
| 74 |
|
---|
[145] | 75 | # Path + target file to be built
|
---|
[57] | 76 | TARGET = $(BUILD_DIR)/$(PROG)
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | #########################
|
---|
| 80 | # Compilers and linkers #
|
---|
| 81 | #########################
|
---|
| 82 |
|
---|
| 83 | # Make
|
---|
| 84 | MAKE = mingw32-make.exe
|
---|
| 85 |
|
---|
| 86 | # Assembler
|
---|
[187] | 87 | AS = nasm.exe
|
---|
[57] | 88 |
|
---|
| 89 | # use this command to erase files.
|
---|
| 90 | RM = -del /Q
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | #############################
|
---|
| 94 | # Compiler and linker flags #
|
---|
| 95 | #############################
|
---|
| 96 |
|
---|
| 97 | # Assembly compiler flags
|
---|
| 98 | ASFLAGS = -f bin # Produce binary object files
|
---|
| 99 | ASFLAGS += $(DEFS) # Preprocessor defines
|
---|
| 100 | ASFLAGS += $(IHEADERS) # Set header file directory paths
|
---|
| 101 | ASFLAGS += -Worphan-labels # Warn about labels without colon
|
---|
[592] | 102 | ASFLAGS += -Ox # Optimize operands to their shortest forms
|
---|
[57] | 103 |
|
---|
| 104 |
|
---|
| 105 | ############################################
|
---|
| 106 | # Build process. Actual work is done here. #
|
---|
| 107 | ############################################
|
---|
| 108 |
|
---|
[145] | 109 | .PHONY: all at xtplus xt clean release
|
---|
[57] | 110 |
|
---|
[425] | 111 | all: clean release
|
---|
[145] | 112 | @echo All done!
|
---|
[57] | 113 |
|
---|
| 114 | at:
|
---|
[82] | 115 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.$(EXTENSION)"
|
---|
[145] | 116 | @echo AT version "$(TARGET)_at.$(EXTENSION)" built.
|
---|
[57] | 117 |
|
---|
| 118 | xtplus:
|
---|
[82] | 119 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.$(EXTENSION)"
|
---|
[293] | 120 | @echo XT Plus version "$(TARGET)_xtp.$(EXTENSION)" built.
|
---|
[57] | 121 |
|
---|
| 122 | xt:
|
---|
[82] | 123 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET).$(EXTENSION)"
|
---|
[145] | 124 | @echo XT version "$(TARGET).$(EXTENSION)" built.
|
---|
[57] | 125 |
|
---|
| 126 | clean:
|
---|
| 127 | @$(RM) $(BUILD_DIR)\*.*
|
---|
| 128 | @echo Deleted "(*.*)" from "$(BUILD_DIR)/"
|
---|
[145] | 129 |
|
---|
| 130 | release: xt
|
---|
| 131 | @echo Compressing with UPX...
|
---|
| 132 | @upx -qq --8086 --ultra-brute $(TARGET).$(EXTENSION)
|
---|
| 133 | @echo Done! XT version is ready for release.
|
---|
[370] | 134 |
|
---|
| 135 | xt_unused: xt
|
---|
| 136 | @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -o"$(TARGET)_xt_unused.asm" -E -DCHECK_FOR_UNUSED_ENTRYPOINTS
|
---|
[592] | 137 | @perl ..\Tools\unused.pl $(TARGET)_xt.lst $(TARGET)_xt_unused.asm
|
---|
[370] | 138 |
|
---|