Обход некоторых ограничений утилиты BUILD.

??????? ?????? ? Windows Driver Kit ?????????? ?? ??????? BUILD. ??? ??????? ????????? ????????? ????????, ??????????? ??????????? (? ????????? ?????? ?? ???) ? ?????????????? ????????? ??? ??????? NMAKE, ???????, ??????????, ? ????????? ??? ???????? ?????? ?? ??????. ? ?????????, BUILD ?????????? ? ?????????? ?? ???????? «??? ??????????», ????????????? ???????????? ????? – ??? ???????? ?????? ?????????? Windows. ??? ??? ??? ??????? ?????????? ?????????? ?????????????.

???? ?? ??? – ?????? ??????????? ?????????? ? ???????? ?????????????.

? ???????, ????? ????????? ???????????? ?????????? ?? ?????? ?????? ???? ???????? ?????? NOBUILD. ????? ??? ????? DIRS ????:

 

 !if defined(NOBUILD) 

DIRS = \
    foo \

!else

DIRS = \
    foo \
    bar \

!endif

??? ??????????? ?? ????, ???????? ?????? NOBUILD ??? ???, BUILD ?????????? ??????? ??? ?????????? foo ? bar. ????? ????, ??? ????? DIRS ???? ???? ?? ??????? ??????:

 Some random garbage in DIRS file.

DIRS = \
    foo \
    bar \

More random garbage.

??????? ??????, ??? BUILD ?????? ????????? ???? ? ?????? ??????, ???????? ?? ?????????? ???????? DIRS ? OPTIONAL_DIRS ????????? ????????? ?????. ???????, ???????????????? ??????????????? ?????????:

 FOO = \
    foo \

DIRS = \
    $(FOO) \
    bar \

??????????? ???????? ? ?????? SOURCES. BUILD ?????????? ????????? ?????????????, ??????????? ?????? ??????????? ??????? SOURCES ? ??? ?????????-????????? ?????????. ?????????, ??? ??? ????????? ?????????????? ?????? ???????? NMAKE. ??? ?? ?????

?????? ??????????, ??????????????? ??? ??????, ???????? ???? MAKEFILE:

 #
# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source
# file to this component.  This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def

?????? ???? ???? ???????? NMAKE, ??? ??????? ?? ???? ???????? (PASS0, PASS1 ? PASS2). ?? ?????????, ?? ?????? ???????? ??????????? ??????? ??????, ?????????? ? SOURCES. (??????? ? WDK ??? Vista MAKEFILE ???? ????????????. ? ?????? ??? ??????????, ????????????? ???????????? MAKEFILE.DEF.) ????????? ?????? ????????? make-?????? ???????? ??? ???:

 MAKEFILE
+- MAKEFILE.DEF
   +- MAKEFILE.NEW
      +- MAKEFILE.PLT
         +- PROJECT.MK
      +- SOURCES
      +- _OBJECTS.MAC
      +- $(TARGET_DIRECTORY)mk.inc
      +- MAKEFILE.INC
      +- …

?????? ?????, ??? MAKEFILE ? MAKEFILE.INC – ?????? ??????? ??? ????????????? ??????????? ? ??????? ??????. ???, ????? ?????? ???????????? ??????, ?????????? ?? ???????? MAKEFILE.DEF ? ??????, ???? ???????? ?????? NOBUILD:

 !if !defined(NOBUILD)

#
# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source
# file to this component.  This file merely indirects to the real make file
# that is shared by all the components of Windows NT
#
!INCLUDE $(NTMAKEENV)\makefile.def

!endif

? ??????????, BUILD ??-???????? ??????? NMAKE, ?? ??? ????????????? ?????? ??????????.

Cross-posted from blog.not-a-kernel-guy.com.