[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
eval function within 'ifeq... else... endif' causes error
From: |
François Duranleau |
Subject: |
eval function within 'ifeq... else... endif' causes error |
Date: |
Fri, 11 Mar 2005 20:14:47 -0500 (EST) |
Hi!
[This report was sent to address@hidden, but later I realized that
maybe I should rather send it this here.]
I was playing with some rule generating functions (using the eval function
of GNU Make) and I hit a problem when inserting conditionals. Here is an
example where make says there is an error (also in attachment):
# Makefile begin
define other-rule
.PHONY: other-rule
other-rule:
@ echo other-rule
endef
define other-rule2
.PHONY: other-rule2
other-rule:
@ echo other-rule2
endef
define rule_test
.PHONY: rule-test
rule-test: other-rule
ifeq ($$(strip $$(VAR)),)
$$(eval $$(call other-rule))
else
$$(eval $$(call other-rule2))
endif
endef
$(eval $(rule_test))
# Makefile end
And then, running make with the above produces:
% make
Makefile:20: *** missing `endif'. Stop.
I was actually working at school and there I had no problem (they are
running Fedora Core release 2 (Tettnang)). The base version of make 3.80
(the same as at my home, see at the end for some info about the package).
Here are some details of their package:
% rpm -q -i make
Name : make Relocations: /usr
Version : 3.80 Vendor: Red Hat, Inc.
Release : 3 Build Date: Mon Feb 16 23:41:39 2004
Install Date: Thu Sep 23 14:59:04 2004 Build Host: loma.devel.redhat.com
Group : Development/Tools Source RPM: make-3.80-3.src.rpm
Size : 772995 License: GPL
Signature : DSA/SHA1, Thu May 6 18:56:20 2004, Key ID b44269d04f2a6fd2
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary : A GNU tool which simplifies the build process for users.
Description :
<snip description>
When I uploaded my stuff here at home, I had a surprise when make reported
the error above. So I fetched the sources code of make for Debian (make
3.80-9) and Red Hat (make-3.80-3.src.rpm) and then I looked at the patched
code. In the Red Hat patch, they added something about conditionals when
evaluating a buffer, so I added the same thing and now make works well
with the example above. In attachment, there is a patch for the changes I
made (or actually, that the RH guys did). It's actually a diff between the
patch Debian code for 3.80-9 and the RH modifications, but I think it
should work with the base code of make 3.80.
I don't know though if there is something written somewhere about GNU make
that states that the behavior with the above Makefile is normal or no. To
me, it seems more like no.
Anyway, hope this helps.
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (600, 'testing'), (50, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.27
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages make depends on:
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
__________________________________________________________________________
François Duranleau Étudiant Ph.D. Informatique
LIGUM Université de Montréal
"Rien n'est plus gênant que les faits: ils empêchent de croire ce qu'on
veut."
- Claude Roy
Les Chercheurs de Dieu, 1981
make_3.80-9cond.diff.gz
Description: GNU Zip compressed data
Makefile
Description: Text document
- eval function within 'ifeq... else... endif' causes error,
François Duranleau <=