Summary: Using $(eval) to get information at the time a target is invoked, but 
instead information gotten is when "make" is invoked.

 

                Problem occurs for make3.81 and make 3.82 on Windows XP

 

                However if makefile is modified to look for information in a 
subfolder then correct results are obtained.

 

                Equivalent makefile in Linux for 3.81 works correctly also

 

Folder contents:

 

D:\testEval>dir

Volume in drive D is Data

Volume Serial Number is 6AEC-315C

 

Directory of D:\testEval

 

01/07/2011  08:12 PM    <DIR>          .

01/07/2011  08:12 PM    <DIR>          ..

01/05/2011  11:31 AM                 0 Hello.c

01/07/2011  08:06 PM               321 makefile

01/05/2011  11:31 AM                 0 world.c

               3 File(s)            321 bytes

               2 Dir(s)   8,175,538,176 bytes free

 

D:\testEval>

 

Makefile contents:

 

SRC_DIR = ./

 

PROG_NAME = test

 

define PROGRAM_template

            $(1)_SRC_DIR   = $$(SRC_DIR)

            $(1)_SRC_FILES = $$(wildcard $$($(1)_SRC_DIR)*.c)

endef

 

$(eval $(call PROGRAM_template,$(PROG_NAME)))

 

clean:

            del hello.c

 

all:

            rem $(test_SRC_DIR)

            rem $(test_SRC_FILES)

            rem $(wildcard $(test_SRC_DIR)*.c)

 

Invocation 

 

make clean all

 

Results:

 

D:\testEval>make clean all

del hello.c

rem ./

rem ./Hello.c ./world.c

rem ./Hello.c ./world.c

 

Expected Results:

 

del hello.c

rem ./

rem ./world.c

rem ./world.c

 

A makefile (makefile_sav) looking for files under a subfolder <test> works: 
(<test> contains hello.c and world.c files)

 

SRC_DIR = ./

 

PROG_NAME = test

 

define PROGRAM_template

            $(1)_SRC_DIR   = $$(join $$(SRC_DIR),$(1)/)

            $(1)_SRC_FILES = $$(wildcard $$($(1)_SRC_DIR)*.c)

endef

 

$(eval $(call PROGRAM_template,$(PROG_NAME)))

 

clean:

            del test\hello.c

 

all:

            rem $(test_SRC_DIR)

            rem $(test_SRC_FILES)

            rem $(wildcard $(test_SRC_DIR)*.c)

 

The output from this is:

 

G:\testEval>make -f makefile_sav clean all

del test\hello.c

rem ./test/

rem ./test/world.c

rem ./test/world.c

 

and it is correct.

 

I'll be glad to send everything (just a few files) in a zip file.  Please 
advise.

 

Thanks,


SC Hsu

 

 

 

            

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to