Changeset 63 for trunk/bootcode/Makefile
- Timestamp:
- Oct 9, 2016, 10:53:41 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/Makefile
r60 r63 1 1 ############################################################################### 2 # Makefile :: Builds the 'airboot.bin' 16-bits RAW Loader Image # 2 # Makefile :: Builds the 'airboot.bin' 16-bits RAW Loader Image (WMake) # 3 # --------------------------------------------------------------------------- # 4 # # 5 # This Makefile builds the 'airboot.bin' program. # 6 # This is the actual AiR-BOOT that you see when starting your system. # 7 # It operates at the BIOS level and thus without any operating-system # 8 # being active. It's first 512 bytes get loaded by the BIOS at address # 9 # 0000:7C00 and then control is transferred. This first 512 bytes constitute # 10 # the AiR-BOOT MBR-code, and this code loads the rest of the AiR-BOOT image. # 11 # # 12 # AiR-BOOT, as designed by Martin Kiewitz, boosts a lot of powerful features # 13 # in a tiny space (just over 31kB). One of this features is detecting # 14 # possible virusses. This detection code is "hooked" into the interrupt-chain # 15 # and therefore has it's own relocations which are not related to the main # 16 # loader image. For this reason, when the main source 'air-boot.asm' is # 17 # assembled to a RAW image, this virus-protection code is "embedded" as the # 18 # last step. You could compare this to binding a resource-file to an OS/2 # 19 # executable. # 20 # # 21 # When AiR-BOOT gets control, this virus-protection code is copied elsewhere # 22 # and hooked into the interrupt-system. So it functions kinda like a DOS TSR. # 23 # # 24 # This embedding proccess consists of three parts: # 25 # - Assembling the virus-detection code, 'mbrprot.asm', which always results # 26 # in a 1024 bytes image. # 27 # - Compiling the 'fixcode' program that does the actual embedding. # 28 # - Running the 'fixcode' program against 'air-boot.com' creating the # 29 # final 'airboot.bin' image. # 30 # # 31 # After these operations have been completed, the 'airboot.bin' image # 32 # is ready to be installed. # 33 # # 3 34 ############################################################################### 4 # rousseau@ecomstation.com 5 6 # 7 # This Makefile builds the 'airboot.bin' program. 8 # This is the actual AiR-BOOT that you see when starting your system. 9 # It operates at the BIOS level and thus without any operating-system 10 # being active. It's first 512 bytes get loaded by the BIOS at address 11 # 0000:7C00 and then control is transferred. This first 512 bytes constitute 12 # the AiR-BOOT MBR-code, and this code loads the rest of the AiR-BOOT image. 13 # 14 15 # 16 # AiR-BOOT, as designed by Martin Kiewitz, boosts a lot of powerful features 17 # in a tiny space (just over 31kB). One of this features is detecting 18 # possible virusses. This detection code is "hooked" into the interrupt-chain 19 # and therefore has it's own relocations which are not related to the main 20 # loader image. For this reason, when the main source 'air-boot.asm' is 21 # assembled to a RAW image, this virus-protection code is "embedded" as the 22 # last step. You could compare this to binding a resource-file to an OS/2 23 # executable. 24 # 25 # When AiR-BOOT gets control, this virus-protection code is copied elsewhere 26 # and hooked into the interrupt-system. So it functions kinda like a DOS TSR. 27 # 28 29 # 30 # This embedding proccess consists of three parts: 31 # - Assembling the virus-detection code, 'mbrprot.asm', which always results 32 # in a 1024 bytes image. 33 # - Compiling the 'fixcode' program that does the actual embedding. 34 # - Running the 'fixcode' program against 'air-boot.com' creating the 35 # final 'airboot.bin' image. 36 # 37 38 # 39 # After these operations have been completed, the 'airboot.bin' image 40 # is ready to be installed. 41 # 42 43 44 45 46 # DEFINITIONS AND STUFF 35 36 37 38 # DEFINITIONS AND STUFF 47 39 # _____________________________________________________________________________ 48 40 … … 50 42 # Include a Master Makefile with several cross-platform definitions and macros. 51 43 # This is used to compensate for the differences between the target platforms. 52 !include 44 !include ../include/makefile.mif 53 45 54 46 # On my system, JWasm takes forever to generate a list-file when on a network … … 56 48 # makes no difference. If you experience the same, then put a '#' in front of 57 49 # the variable below to keep JWasm from generating a list-file. 58 JWASM_LIST_FILE=-Fl=$^&.lst50 #~ JWASM_LIST_FILE=-Fl=$^&.lst 59 51 60 52 # Specifies the level of debugging. … … 136 128 137 129 # If no assembler is specified then default to JWasm. 138 !ifndef 130 !ifndef ASM 139 131 ASM=jwasm 140 132 !endif … … 144 136 # set the XMS memory limit to 0. 145 137 # JWasmR will probably run out of memory and cannot be used. 146 !ifdef 138 !ifdef __MSDOS__ 147 139 ASM=tasm 148 140 !endif … … 151 143 # So we override to jwasm when a non-jwasm assembler is specified and 152 144 # we are building on Linux. 153 !ifdef 145 !ifdef __LINUX__ 154 146 !if "$(ASM)"=="masm" | "$(ASM)"=="tasm" | "$(ASM)"=="alp" 155 147 ASM=jwasm … … 163 155 # JWASM 164 156 !if "$(ASM)"=="jwasm" 165 # -Cp 166 # -zcw 167 # -Zm 168 # -Zd 169 # -Zi 157 # -Cp = case sensitive symbols 158 # -zcw = no _ prefix on symbols (C model) 159 # -Zm = Masm51 compat -- don't use ! (Will generate incorrect offsets) 160 # -Zd = line number debug info 161 # -Zi = symbolic debug info 170 162 ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -W0 -Cp -zcw -Fo$^. -Sa $(JWASM_LIST_FILE) -Fw$^&.err 171 163 ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -W4 -Cp -zcw -Zd -Zi -Fo$^. -Sa $(JWASM_LIST_FILE) -Fw$^&.err 172 164 ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DJWASM -q -W4 -Cp -zcw -Zd -Zi -Fo$^. -Sa $(JWASM_LIST_FILE) -Fw$^&.err 165 # Workaround for JWasm list-file generation. 166 # Generate the list-file on a local drive so JWasm doen't take forever. 167 # This is done in the recipe. 168 JWASM_LIST_FILE_LOC=$(%TEMP)\ 169 JWASM_LIST_FILE=-Fl=$(JWASM_LIST_FILE_LOC)$^&.lst 173 170 174 171 # WASM 175 172 !elseif "$(ASM)"=="wasm" 176 # -w0 173 # -w0 = suppress warnings (wasm is nice to check for missing size qualifiers) 177 174 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -w4 -fo=$^. -fr=$^&.err 178 175 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dWASM -zq -w4 -d1 -fo=$^. -fr=$^&.err … … 181 178 # TASM 182 179 !elseif "$(ASM)"=="tasm" 183 # -ml 180 # -ml = case sensitive symbols 184 181 ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -l 185 182 ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dTASM -t -ml -m9 -z -zi -c -la … … 242 239 243 240 244 # 241 # BEFORE AND AFTER TARGETS 245 242 # _____________________________________________________________________________ 246 243 … … 257 254 # ----------------------------------------------------------------------------- 258 255 .AFTER 259 # 260 !ifdef 256 # @echo == AFTER == 257 !ifdef __MSDOS__ 261 258 @echo $(WARN_DOS_BLD_ENV) 262 259 !endif … … 268 265 269 266 270 # 267 # PSEUDO TARGETS FOR PREPARATION 271 268 # _____________________________________________________________________________ 272 269 … … 281 278 # the intermediate files intact. 282 279 # ----------------------------------------------------------------------------- 283 all: 280 all: .SYMBOLIC Makefile.bu $(BLD_LANGUAGES) footer 284 281 # @echo ALL !! 285 282 # @#MAKE $(BLD_LANGUAGES) … … 296 293 # This is a 'pre-action' before assembling the AiR-BOOT.ASM source. 297 294 # ----------------------------------------------------------------------------- 298 langsetup: 295 langsetup: .SYMBOLIC .MULTIPLE 299 296 # Default to development language is none defined. 300 297 !if "$(%BLD_LANG)"=="" … … 305 302 # Note that this target is not used as a 'dependency' but 'called' explicitly 306 303 # by the $(BLD_LANGUAGES) target. 307 @echo include text/$(%BLD_LANG)/mbr.asm >text$(DS)txtmbr.asm308 @echo include text/$(%BLD_LANG)/menus.asm 309 @echo include text/$(%BLD_LANG)/other.asm 304 @echo include text/$(%BLD_LANG)/mbr.asm> text$(DS)txtmbr.asm 305 @echo include text/$(%BLD_LANG)/menus.asm> text$(DS)txtmenus.asm 306 @echo include text/$(%BLD_LANG)/other.asm> text$(DS)txtother.asm 310 307 311 308 … … 318 315 # depends on it. 319 316 # ----------------------------------------------------------------------------- 320 $(BLD_LANGUAGES): 317 $(BLD_LANGUAGES): .SYMBOLIC 321 318 @SET BLD_LANG=$@ 322 319 @%MAKE header … … 330 327 # @echo $(%AB_DEV) 331 328 # Do not rename for dev-build 332 !if 329 !if "$(%AB_DEV)"!="TRUE" 333 330 #~ !ifndef %AB_DEV 334 331 @echo. … … 353 350 # SHOW THE HEADER FOR THE TARGET BEING BUILT 354 351 # ----------------------------------------------------------------------------- 355 header: 352 header: .SYMBOLIC .MULTIPLE 356 353 @echo. 357 354 @echo ===================================================================== … … 364 361 # SHOW THE FOOTER 365 362 # ----------------------------------------------------------------------------- 366 footer: 363 footer: .SYMBOLIC 367 364 # $(RM) $(TARGET) 368 365 @echo All targets up to date ! … … 378 375 # using the new level. 379 376 # ----------------------------------------------------------------------------- 380 Makefile.bu: 377 Makefile.bu: Makefile 381 378 @echo. 382 379 @echo Makefile modified, forcing rebuild of all targets ! … … 421 418 # It will be embedded into the final AiR-BOOT binary. (airboot.bin) 422 419 # 423 mbrprot: 420 mbrprot: .symbolic 424 421 @echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 425 422 @echo @ Building MBR Protection Image and FixCode first @ … … 434 431 # FixCode embeds the MBR Protection Image into the final AiR-BOOT binary. 435 432 # 436 fixcode: 433 fixcode: .procedure 437 434 cd ..$(DS)tools$(DS)internal 438 435 $(MAKE) -h 439 436 cd ..$(DS)..$(DS)bootcode 440 437 441 442 # MAIN TARGETS 438 # 439 # Installer installs the loader to disk 440 # 441 installer2: .procedure 442 cd ..$(DS)install$(DS)c 443 $(MAKE) -h airboot2.exe 444 cd ..$(DS)..$(DS)bootcode 445 446 # MAIN TARGETS 443 447 # _____________________________________________________________________________ 444 448 … … 454 458 # with NDISASM for cross reference. 455 459 # ----------------------------------------------------------------------------- 456 $(TARGET): 460 $(TARGET): .MULTIPLE Makefile.bu $(BASENAME).com 457 461 @echo $^.: [Final 16-bits raw Binary Image] 458 !ifdef 462 !ifdef __MSDOS__ 459 463 ..$(DS)tools$(DS)internal$(DS)fixcoded.exe 460 464 !endif 461 !ifdef 465 !ifdef __OS2__ 462 466 ..$(DS)tools$(DS)internal$(DS)fixcode2.exe 463 467 !endif 464 !ifdef 468 !ifdef __NT__ 465 469 ..$(DS)tools$(DS)internal$(DS)fixcodew.exe 466 470 !endif 467 !ifdef 471 !ifdef __LINUX__ 468 472 # ..$(DS)tools$(DS)internal$(DS)fixcode 469 473 @chmod +x ..$(DS)tools$(DS)internal$(DS)fixcodel.elf … … 472 476 !endif 473 477 @echo. 474 !ifndef 478 !ifndef __MSDOS__ 475 479 ndisasm $(BASENAME).com > $(BASENAME).com.nda 476 480 ndisasm $(TARGET) > $(TARGET).nda 477 481 !endif 478 482 @echo. 479 @if exist $^. @echo 483 @if exist $^. @echo ** $^. $(MSG_SUCCESS) - [$(%BLD_LANG) version] ** 480 484 481 485 … … 491 495 # So we use DOS COM linkage to proteced us from overflow incorrect fixups. 492 496 # ----------------------------------------------------------------------------- 493 $(BASENAME).com: 494 @echo $^.: 497 $(BASENAME).com: .MULTIPLE $(BASENAME).obj 498 @echo $^.: [16-bits non-100h Intermediate Image] 495 499 $(LNK) $(LNK_FLAGS) file $^&.obj name $^. sys dos com 496 500 # $(LNK) $(LNK_FLAGS) file $^&.obj name $^. form raw … … 505 509 # - once as a disassembly with opcodes in it 506 510 # ----------------------------------------------------------------------------- 507 $(BASENAME).obj: 508 @echo $^.: 511 $(BASENAME).obj: .MULTIPLE $(BASENAME).asm 512 @echo $^.: [16-bits OMF Object File] 509 513 $(ASM) $(ASM_FLAGS) $(BASENAME).asm 510 !ifndef __MSDOS__ 514 !if "$(%AB_DEV)"=="TRUE" 515 @copy ..\install\c\airboot2.exe . 516 !endif 517 !if "$(ASM)"=="jwasm" 518 # Workaround for generating JWasm list-files. 519 # Command 'move' does not work across drives. 520 # So we do a 'copy' then 'del' instead. 521 @if not exist $^&.lst copy $(JWASM_LIST_FILE_LOC)$^&.lst . 522 @if exist $(JWASM_LIST_FILE_LOC)$^&.lst del $(JWASM_LIST_FILE_LOC)$^&.lst 523 !endif 524 !ifndef __MSDOS__ 511 525 @wdis -fi $^. > $^..wda 512 526 !endif … … 515 529 516 530 517 # 531 # MAIN ACTIONS 518 532 # _____________________________________________________________________________ 519 533 … … 527 541 # This is the main target when developing. 528 542 # ----------------------------------------------------------------------------- 529 dev: 543 dev: .SYMBOLIC 530 544 @%MAKE rmbin 531 545 @%MAKE mbrprot 532 546 @%MAKE fixcode 547 @%MAKE installer2 533 548 SET AB_DEV=TRUE 534 549 # @%MAKE $(DEV_BLD_LANG) … … 538 553 @$(MAKE) -h $(DEV_BLD_LANG) 539 554 # Display the BLDLEVEL information if we are building on OS/2. 540 !ifdef 555 !ifdef __OS2__ 541 556 @echo. 542 557 @bldlevel $(TARGET) … … 546 561 @type airboot.md5 547 562 !endif 548 !ifdef 563 !ifdef __LINUX__ 549 564 @echo. 550 565 @if exist air-boot.lst @grep ^zzz_code_space air-boot.lst … … 559 574 # REBUILD ALL TARGETS 560 575 # ----------------------------------------------------------------------------- 561 rebuild: 576 rebuild: .SYMBOLIC 562 577 @%MAKE clean 563 578 @%MAKE all … … 567 582 # CLEANUP (intermediate files) 568 583 # ----------------------------------------------------------------------------- 569 clean: 584 clean: .SYMBOLIC .MULTIPLE 570 585 # @echo CLEANING UP 571 586 @for %%i in ($(TARGET)) do @if exist %%i $(RM) %%i 572 587 @if exist *.com $(RM) *.com 573 @if exist *. com$(RM) *.exe588 @if exist *.exe $(RM) *.exe 574 589 @if exist *.obj $(RM) *.obj 575 590 @if exist *.wda $(RM) *.wda … … 584 599 # REMOVE ALL RESIDUAL .bin FILES (old builds) 585 600 # ----------------------------------------------------------------------------- 586 rmbin: 601 rmbin: .SYMBOLIC 587 602 @if exist *.bin $(RM) *.bin 588 603 … … 594 609 # Then it installs the English version to 'release' as 'airboot.bin'. 595 610 # ----------------------------------------------------------------------------- 596 dist: 611 dist: .SYMBOLIC 597 612 @if exist *.bin $(CP) *.bin ..$(DS)release$(DS)bootcode 598 613 @if exist airbt-en.bin $(CP) airbt-en.bin ..$(DS)release$(DS)dos$(DS)$(TARGET) … … 605 620 # SHOW HELP ON USING THIS MAKEFILE 606 621 # ----------------------------------------------------------------------------- 607 help: 608 @echo. 609 @echo 610 @echo wmaketo build all targets and all languages611 @echo wmake devto build a develoopment target612 @echo wmake [LANG]to build EN,DE,NL,FR,IT or RU versions613 @echo wmake listto show the list of buildable targets614 @echo wmake cleanto remove almost all generated files615 @echo wmake rmbinto remove all residual 'bin' files616 @echo wmake rebuildto rebuild all targets617 @echo wmake distto populate the dist directories618 @echo wmake help forthis information622 help: .SYMBOLIC 623 @echo. 624 @echo The following actions are available: 625 @echo wmake to build all targets and all languages 626 @echo wmake dev to build a develoopment target 627 @echo wmake [LANG] to build EN,DE,NL,FR,IT or RU versions 628 @echo wmake list to show the list of buildable targets 629 @echo wmake clean to remove almost all generated files 630 @echo wmake rmbin to remove all residual 'bin' files 631 @echo wmake rebuild to rebuild all targets 632 @echo wmake dist to populate the dist directories 633 @echo wmake help to show this information 619 634 @echo. 620 635 … … 623 638 # SHOW LIST OF BUILDABLE TARGETS 624 639 # ----------------------------------------------------------------------------- 625 show: 626 @echo. 627 @echo 640 show: .SYMBOLIC 641 @echo. 642 @echo The following [case sensitive] targets can be built: 628 643 @for %%i in ($(TARGET)) do @echo %%i 629 644 @echo. 630 645 # Alias for show 631 list: 646 list: .SYMBOLIC 632 647 @%MAKE show 633 648 … … 638 653 .ERROR 639 654 @echo. 640 @echo 641 @echo 642 @echo 643 @echo 644 @echo 645 @echo 646 @echo 655 @echo Oops! 656 @echo Some error occured in this build session. 657 @echo If you see stuff about "positive count" 658 @echo you have a section overlap. 659 @echo Check the z_* values at the end of the list-file 660 @echo and look for a negative gap. 661 @echo Type 'wmake help' in the target dir for a list of actions. 647 662 # @%MAKE help 648 663 @echo. 649 664 650 651 # -----------------------------------------------------------------------------652 # How the hell can we use more than one command in the for-loop ??653 # -----------------------------------------------------------------------------654 ttt: .SYMBOLIC655 # This does not work...656 # @for %%i in ($(BLD_LANGUAGES)) do %%i=X; $%WMAKE;
Note:
See TracChangeset
for help on using the changeset viewer.