DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Ports and Packages

FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 26th March 2009
indiocolifa indiocolifa is offline
Real Name: Hernán Di Pietro
UnixUser
 
Join Date: Mar 2009
Location: La Plata
Posts: 17
Thanked 0 Times in 0 Posts
Default ${REINPLACE_CMD} on Makefile

I'm trying to use the 'a' sed command on a Makefile to insert a line. This is a Makefile for a port that's currently broken.
Code:
$@{REINPLACE_CMD} '|<iostream.h>|a \\ \#include <ios>|'
The problem is that 'a' requires the text to be replaced on a new line and I don't know how to put that newline character in the Makefile. make is very picky about tabs, blanks, etc.

sed a command syntax ref:

[1addr]a \
text

Thank you...

(if this post is more appropiate to the programming section, feel free to move it)
Reply With Quote
  #2   (View Single Post)  
Old 26th March 2009
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Thanked 49 Times in 43 Posts
Default

I think this can't be done with pmake as it treats '\' followed by newline as a space unlike gmake where this is passed 'as it is' to the shell.

Ofcourse, I may be wrong. I would be interested to know if there is a way to do this. Try asking on the fbsd ML or freebsdforum.
Reply With Quote
  #3   (View Single Post)  
Old 26th March 2009
J65nko J65nko is online now
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,193
Thanked 182 Times in 149 Posts
Default

You can create the sed command file in Make
Code:
FILES= a.src b.src

EDIT    : sedcmd
        sed -f sedcmd ${FILES}

sedcmd  :
        echo '/<iostream.h>/a\\' >${.TARGET}
        echo '#include <ios>' >>${.TARGET}
This will produce the following
Code:
$ cat sedcmd
/<iostream.h>/a\
#include <ios>
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #4   (View Single Post)  
Old 26th March 2009
BSDKaffee's Avatar
BSDKaffee BSDKaffee is offline
Real Name: Jason Hale
Coffee Addict
 
Join Date: May 2008
Location: Wintersville, Ohio
Posts: 212
Thanked 36 Times in 34 Posts
Default

IMO, you're better off just using a patch file. Too many replacements like this make the Makefile unneccesarily overbloated and pehaps confusing to everyone else. REINPLACE_CMD is good for replacing many instances of something in a single file or something that may be dependent upon architecture, etc.
Reply With Quote
Reply

Tags
sed append makefile

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Makefile Problem BadWolf Programming 4 15th March 2009 01:58 PM
ports config and makefile scripting boincv FreeBSD Ports and Packages 6 1st October 2008 07:57 AM
Change Makefile options in ports shep FreeBSD Ports and Packages 5 18th August 2008 07:58 AM
First Post.. Woot!! --- An obvious Makefile question..? roundkat OpenBSD Packages and Ports 2 2nd May 2008 03:05 PM


All times are GMT. The time now is 02:20 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick