Extra:Cygwin win32 makefile

Fișier Makefile care poate fi folosit pe o consolă cygwin (locală sau SSH) pentru configurarea mediului de dezvoltare Windows SDK și folosirea unui fișier makefile nativ Windows (folosit de utilitarul nmake).

Se construiesc fișiere .bat specializate pentru fiecare target dorit (specificate prin variabila TARGETS).

Makefile
TARGETS = all clean BAT_TARGETS = $(addsuffix .bat, $(addprefix cmd_build., $(TARGETS)))

first: all

$(TARGETS): % : cmd_build.%.bat cmd.exe /E:ON /V:ON /T:0E /C $<

$(BAT_TARGETS): echo '"C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd" && nmake /nologo $(subst .bat,,$(subst cmd_build.,,$@))' > $@

bat_clean: -rm -f $(BAT_TARGETS) *~

Exemplu de rulare
Administrator@scarlet:~/teme/t1$ make -f makefile.cygwin cmd.exe /E:ON /V:ON /T:0E /C cmd_build.all.bat

C:\cygwin\home\Administrator\teme\t1>"C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd"  && nmake /nologo all ERROR: The system was unable to find the specified registry key or value.

Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v6.1. Targeting Windows Server 2003 x86 DEBUG

cd parser && nmake /nologo parser.tab.obj cl /nologo /W3 /EHsc /Za /c parser.tab.c parser.tab.c	cd parser && nmake /nologo parser.yy.obj cl /nologo /W3 /EHsc /Za /c parser.yy.c parser.yy.c parser.yy.c(1302) : warning C4018: '<' : signed/unsigned mismatch cl /nologo /W3 /EHsc /Za /c mini-shell.c mini-shell.c	cl /nologo /W3 /EHsc /Za /Femini-shell.exe mini-shell.obj parser\parser.tab.obj parser\parser.yy.obj

Administrator@scarlet:~/teme/t1$ ls     Makefile.checker     inputs           mini-shell.exe  test_mini-shell_win.zip README.checker      makefile         mini-shell.obj cmd_build.all.bat   makefile.cygwin  outputs cmd_build.clean.bat mini-shell.c     parser

Administrator@scarlet:~/teme/t1$ make -f makefile.cygwin clean cmd.exe /E:ON /V:ON /T:0E /C cmd_build.clean.bat

C:\cygwin\home\Administrator\teme\t1>"C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd"  && nmake /nologo clean ERROR: The system was unable to find the specified registry key or value.

Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v6.1. Targeting Windows Server 2003 x86 DEBUG

del /Q /S *.obj *~ mini-shell.exe Deleted file - C:\cygwin\home\Administrator\teme\t1\mini-shell.obj Deleted file - C:\cygwin\home\Administrator\teme\t1\mini-shell.exe Deleted file - C:\cygwin\home\Administrator\teme\t1\parser\parser.tab.obj Deleted file - C:\cygwin\home\Administrator\teme\t1\parser\parser.yy.obj cd parser && nmake clean

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved.

del /Q /S CUseParser.exe UseParser.exe DisplayStructure.exe Could Not Find C:\cygwin\home\Administrator\teme\t1\parser\CUseParser.exe del /Q /S *.obj *~ Could Not Find C:\cygwin\home\Administrator\teme\t1\parser\*.obj