help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

need help with $(call)


From: DKerns
Subject: need help with $(call)
Date: Fri, 3 Aug 2007 01:30:47 -0500


$ make --version
GNU Make 3.80
$ uname -r
2.6.18-1.2239.fc5

I have strange problem with the $(call) construct

makefile #1)
$ cat Makefile
.EXPORT_ALL_VARIABLES:

PHYSMAP_LEN=0x00800000
PHYSMAP_BOOT=0xBE000000
PHYSMAP_FFS=0xBE040000

mathexp = $(shell gawk 'BEGIN{printf "0x%X\n",$(1)}')

FLASH_FILE_SYSTEM_OFST=$(call mathexp,$(PHYSMAP_FFS)-$(PHYSMAP_BOOT))
FLASH_MAIN_APP_VECTOR_OFST=$(call mathexp,$(PHYSMAP_LEN)-4)

all:
        @echo FLASH_FILE_SYSTEM_OFST = $(FLASH_FILE_SYSTEM_OFST)
        @echo FLASH_MAIN_APP_VECTOR_OFST = $(FLASH_MAIN_APP_VECTOR_OFST)

when I run it I get this:

$ make
gawk: BEGIN{printf "0x%X\n",}
gawk:                       ^ syntax error
gawk: cmd. line:1: BEGIN{printf "0x%X\n",}
gawk: cmd. line:1:                        ^ unexpected newline or end of
string
FLASH_FILE_SYSTEM_OFST = 0x40000
FLASH_MAIN_APP_VECTOR_OFST = 0x7FFFFC

here's makefile #2:
$ cat qq.mk
VALUE1 = 0x10000
VALUE2 = 0xf0
mathexp = $(shell gawk 'BEGIN{printf "0x%X\n",$(1)}')
mathexp2 = $(shell gawk 'BEGIN{printf "0x%X\n",$(1)}' 2>/dev/null)
OFFSET = $(call mathexp,$(VALUE1)-$(VALUE2))
OFFSET2 = $(call mathexp2,$(VALUE1)-$(VALUE2))

all:
        @echo cc -DOFS=$(OFFSET) prog.c
        @echo cc -DOFS=$(OFFSET2) prog.c

when I run it I get this:

$  make -f qq.mk
cc -DOFS=0xFF10 prog.c
cc -DOFS=0xFF10 prog.c

I was hoping to show that the assignment of mathexp2 was clean only because
it discarded stderr, but in fact they both ran clean. doh!
So, anyway, I'm confused. Why does the first Makefile generates errors, ...
and is there a better way to create "mathexp" other then to throw away all
errors?

thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]