# ast nmake implicit prerequisite tests
INCLUDE cc.def
TEST 01 '.PFX.INCLUDE vs. .STD.INCLUDE --noprefix-include'
EXEC --regress=sync --noprefix-include
INPUT Makefile $'.SOURCE.G : uhdr
.SOURCE.h : hdr
%.h : %.G
cp $(*) $(<)
.MAIN : all
all : .MAKE .FORCE .REPEAT
make foo.c
INPUT uhdr/bar.G $'#include "foo.h"'
ERROR - $'+ cp uhdr/bar.G bar.h
hdr/foo.h==foo.h : [current] .LCL.INCLUDE .PFX.INCLUDE .SCAN.c must=1 terminal regular scanned EXISTS
prerequisites: bar.h
uhdr/bar.G==bar.G : [current] must=1 regular EXISTS
()bar.G : [recent] event=[current] force compiled state
'
EXEC --regress=sync --noprefix-include
ERROR - $'
prerequisites: bar.h
uhdr/bar.G==bar.G : [recent] regular EXISTS
()bar.G : [recent] event=[recent] force compiled state
'
EXEC --regress=sync --noprefix-include
TEST 02 '.PFX.INCLUDE vs. .STD.INCLUDE subdir --prefix-include'
EXEC --regress=sync --prefix-include
INPUT Makefile $'.SOURCE.G : uhdr
.SOURCE.h : hdr
%.h : %.G
cp $(*) $(<)
.MAIN : all
all : .MAKE .FORCE .REPEAT
make foo.c
INPUT uhdr/bar.G $'#include "foo.h"'
ERROR - $'+ cp uhdr/bar.G bar.h
hdr/foo.h==foo.h : [current] .LCL.INCLUDE .PFX.INCLUDE .SCAN.c must=1 terminal regular scanned EXISTS
prerequisites: bar.h
uhdr/bar.G==bar.G : [current] must=1 regular EXISTS
()bar.G : [recent] event=[current] force compiled state
'
EXEC --regress=sync --prefix-include
ERROR - $'
prerequisites: bar.h
uhdr/bar.G==bar.G : [recent] regular EXISTS
()bar.G : [recent] event=[recent] force compiled state
'
EXEC --regress=sync --prefix-include
TEST 03 '.PFX.INCLUDE vs. .PFX.INCLUDE . --noprefix-include'
EXEC --regress=sync --noprefix-include
INPUT Makefile $'.SOURCE.G : uhdr
.SOURCE.h : hdr
%.h : %.G
cp $(*) $(<)
.MAIN : all
all : .MAKE .FORCE .REPEAT
make foo.c
INPUT uhdr/bar.G $'#include "foo.h"'
ERROR - $'+ cp uhdr/bar.G bar.h
prerequisites: foo.h
prerequisites: bar.h
uhdr/bar.G==bar.G : [current] must=1 regular EXISTS
()bar.G : [recent] event=[current] force compiled state
prerequisites: foo.h
'
EXEC --regress=sync --noprefix-include
ERROR - $'
prerequisites: foo.h
prerequisites: bar.h
uhdr/bar.G==bar.G : [recent] regular EXISTS
()bar.G : [recent] event=[recent] force compiled state
prerequisites: foo.h
'
EXEC --regress=sync --noprefix-include
TEST 04 '.PFX.INCLUDE vs. .PFX.INCLUDE . --prefix-include'
EXEC --regress=sync --prefix-include
INPUT Makefile $'.SOURCE.G : uhdr
.SOURCE.h : hdr
%.h : %.G
cp $(*) $(<)
.MAIN : all
all : .MAKE .FORCE .REPEAT
make foo.c
INPUT uhdr/bar.G $'#include "foo.h"'
ERROR - $'+ cp uhdr/bar.G bar.h
prerequisites: foo.h
prerequisites: bar.h
uhdr/bar.G==bar.G : [current] must=1 regular EXISTS
()bar.G : [recent] event=[current] force compiled state
prerequisites: foo.h
'
EXEC --regress=sync --prefix-include
ERROR - $'
prerequisites: foo.h
prerequisites: bar.h
uhdr/bar.G==bar.G : [recent] regular EXISTS
()bar.G : [recent] event=[recent] force compiled state
prerequisites: foo.h
'
EXEC --regress=sync --prefix-include
TEST 05 'generate implicit include'
EXEC
INPUT Makefile $'t :: t.c
t.c :
{
echo \'#include "t.h"\'
echo \'main() { return T; }\'
} > $(<)
cat $(>) > $(<)'
INPUT t.src $'#define T 0'
ERROR - $'+ 1> t.c
+ echo \'#include "t.h"\'
+ echo \'main() { return T; }\'
+ cat t.src
+ 1> t.h
+ cc -O -I. -c t.c
+ cc -O -o t t.o'