Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#JAM_USE_CHECKSUMS = 1 ; | ||
|
||
SubDir TOP ; | ||
|
||
if $(NT) { | ||
actions GenerateHeader { | ||
type $(2:C) > $(1:C) | ||
} | ||
} else { | ||
actions GenerateHeader { | ||
cat $(2:C) > $(1:C) | ||
} | ||
} | ||
|
||
local generated.h = [ C.GristFiles test : generated.h ] ; | ||
GenerateHeader $(generated.h) : $(TOP)/template ; | ||
Depends $(generated.h) : $(TOP)/template ; | ||
MakeLocate $(generated.h) : $(TOP) ; | ||
Clean clean : $(generated.h) ; | ||
#Depends [ C.GristFiles test : main.c ] : $(g) ; | ||
|
||
ScanContents $(generated.h) ; | ||
|
||
C.Application test : main.c ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include "generated.h" | ||
|
||
int main() | ||
{ | ||
//printf("Hello, %d\n", VALUE); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define VALUE 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
function TestChecksum() | ||
local function WriteOriginalFiles() | ||
ospath.write_file('template', [[ | ||
#define VALUE 8 | ||
]]) | ||
end | ||
|
||
-- Test for a clean directory. | ||
local originalFiles = { | ||
'Jamfile.jam', | ||
'main.c', | ||
'template', | ||
} | ||
|
||
local originalDirs = { | ||
} | ||
|
||
-- Clean up everything. | ||
WriteOriginalFiles() | ||
ospath.remove('.jamcache') | ||
RunJam{ 'clean' } | ||
TestDirectories(originalDirs) | ||
TestFiles(originalFiles) | ||
|
||
--------------------------------------------------------------------------- | ||
local files | ||
local dirs = { | ||
'$(TOOLCHAIN_PATH)/test/', | ||
} | ||
|
||
local function TestNoopPattern() | ||
local noopPattern = [[ | ||
*** found 10 target(s)... | ||
]] | ||
TestPattern(noopPattern, RunJam{}) | ||
TestDirectories(dirs) | ||
TestFiles(files) | ||
end | ||
|
||
local patternA | ||
local patternB | ||
local patternC | ||
if Platform == 'win32' then | ||
files = { | ||
'generated.h', | ||
'Jamfile.jam', | ||
'main.c', | ||
'template', | ||
'$(TOOLCHAIN_PATH)/test/main.obj', | ||
'$(TOOLCHAIN_PATH)/test/test.release.exe', | ||
'?$(TOOLCHAIN_PATH)/test/test.release.exe.intermediate.manifest', | ||
'$(TOOLCHAIN_PATH)/test/test.release.pdb', | ||
} | ||
|
||
patternA = [[ | ||
*** found 21 target(s)... | ||
*** updating 4 target(s)... | ||
@ GenerateHeader <$(TOOLCHAIN_GRIST):test>generated.h | ||
@ $(C_CC) <$(TOOLCHAIN_GRIST):test>main.obj | ||
!NEXT!@ $(C_LINK) <$(TOOLCHAIN_GRIST):test>test.exe | ||
!NEXT!*** updated 4 target(s)... | ||
]] | ||
else | ||
files = { | ||
'generated.h', | ||
'Jamfile.jam', | ||
'main.c', | ||
'template', | ||
'$(TOOLCHAIN_PATH)/test/main.o', | ||
'$(TOOLCHAIN_PATH)/test/test.release', | ||
} | ||
|
||
patternA = [[ | ||
*** found 10 target(s)... | ||
*** updating 4 target(s)... | ||
@ GenerateHeader <$(TOOLCHAIN_GRIST):test>generated.h | ||
@ $(C_CC) <$(TOOLCHAIN_GRIST):test>main.o | ||
@ $(C_LINK) <$(TOOLCHAIN_GRIST):test>test | ||
*** updated 4 target(s)... | ||
]] | ||
end | ||
|
||
--------------------------------------------------------------------------- | ||
do | ||
TestPattern(patternA, RunJam{}) | ||
TestDirectories(dirs) | ||
TestFiles(files) | ||
end | ||
|
||
--------------------------------------------------------------------------- | ||
do | ||
TestNoopPattern() | ||
end | ||
|
||
--------------------------------------------------------------------------- | ||
do | ||
TestNoopPattern() | ||
end | ||
|
||
--------------------------------------------------------------------------- | ||
do | ||
osprocess.sleep(1.0) | ||
ospath.touch('template') | ||
TestNoopPattern() | ||
end | ||
|
||
--------------------------------------------------------------------------- | ||
do | ||
local pattern | ||
if Platform == 'win32' then | ||
pattern = [[ | ||
*** found 10 target(s)... | ||
*** updating 3 target(s)... | ||
@ GenerateHeader <$(TOOLCHAIN_GRIST):test>generated.h | ||
@ $(C_CC) <$(TOOLCHAIN_GRIST):test>main.obj | ||
!NEXT!@ $(C_LINK) <$(TOOLCHAIN_GRIST):test>test.exe | ||
!NEXT!*** updated 3 target(s)... | ||
]] | ||
else | ||
pattern = [[ | ||
*** found 10 target(s)... | ||
*** updating 3 target(s)... | ||
@ GenerateHeader <$(TOOLCHAIN_GRIST):test>generated.h | ||
@ $(C_CC) <$(TOOLCHAIN_GRIST):test>main.o | ||
*** updated 2 target(s)... | ||
]] | ||
end | ||
|
||
osprocess.sleep(1.0) | ||
ospath.write_file('template', [[ | ||
#define VALUE 10 | ||
]]) | ||
TestPattern(pattern, RunJam{}) | ||
end | ||
|
||
--------------------------------------------------------------------------- | ||
do | ||
TestNoopPattern() | ||
end | ||
|
||
--------------------------------------------------------------------------- | ||
WriteOriginalFiles() | ||
RunJam{ 'clean' } | ||
TestFiles(originalFiles) | ||
TestDirectories(originalDirs) | ||
end |