Date: Sun, 25 Mar 2018 22:50:18 -0600 From: Gary Aitken <freebsd@dreamchaser.org> To: FreeBSD Mailing List <freebsd-ports@freebsd.org> Subject: .if and Makefile issues Message-ID: <85769c6d-a71a-f2c6-8a65-ac9b82f534ab@dreamchaser.org>
next in thread | raw e-mail | index | archive | help
Bewildered and frustrated, looking for some guidance on a seemingly simple task: check the existence of a file and rename it. Looking at a number of examples in the Porter's guide, I should be able to do something like this: post-build: <ht>echo "***** post-build *****" #<ht>Avoid executable name conflict with dcraw port <ht>.if exists ${WRKSRC}/dcraw <ht>echo ===== dcraw exists ===== <ht>mv ${WRKSRC}/dcraw ${WRKSRC}/${PORTNAME}-dcraw <ht>.else <ht>echo ===== dcraw does not exist ===== <ht>.endif That causes: echo "***** post-build *****" ***** post-build ***** .if exists /usr/ports/graphics/ufraw-devel/work/ufraw-6d3259a/dcraw make[1]: exec(.if) failed (No such file or directory) *** Error code 1 I then tried adding parens: post-build: <ht>echo "***** post-build *****" #<ht>Avoid executable name conflict with dcraw port <ht>.if exists(${WRKSRC}/dcraw) <ht>echo "===== dcraw exists =====" <ht>mv ${WRKSRC}/dcraw ${WRKSRC}/${PORTNAME}-dcraw <ht>.else <ht>echo "===== dcraw does not exist =====" <ht>.endif echo "***** post-build *****" ***** post-build ***** .if exists(/usr/ports/graphics/ufraw-devel/work/ufraw-6d3259a/dcraw) Syntax error: "(" unexpected *** Error code 2 I finally got this to do *something*: post-build: <ht>echo "***** post-build *****" # Avoid executable name conflict with dcraw port .if exists ${WRKSRC}/dcraw echo ===== dcraw exists ===== mv ${WRKSRC}/dcraw ${WRKSRC}/${PORTNAME}-dcraw .else <ht>echo ===== dcraw does not exist ===== .endif echo "***** post-build *****" ***** post-build ***** echo "===== dcraw does not exist =====" ===== dcraw does not exist ===== Unfortunately, the file *does* exist. Can someone enlighten me as to what is going on in the above three situations, to further my education? Any hints / pointers would be much appreciated: 1. Why does the .if, .else, and .endif have to have no leading whitespace? 2. Why does it require the <ht> on the stmt after the else but not after the .if? (Same behavior with tabs on the ones after .if) 3. Why doesn't it find the file? 4. What's a right way to do this? # ls /usr/ports/graphics/ufraw-devel/work/ufraw-6d3259a/dcraw /usr/ports/graphics/ufraw-devel/work/ufraw-6d3259a/dcraw Thanks, off to sleep to try to save what little hair is left. Gary
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85769c6d-a71a-f2c6-8a65-ac9b82f534ab>