Makefile: multiple target variable substitution


 
Thread Tools Search this Thread
Top Forums Programming Makefile: multiple target variable substitution
# 1  
Old 09-24-2009
Makefile: multiple target variable substitution

Greetings!

Basically, I would like to properly handle this with gnu make:

alltools: my_tool mysecond_tool mythird_tool etc_tool

%_tool: dir1/%_tool.vf dir2/%_tool/subdir2/%_tool.ver
<tab>@echo done

%.vf:
<tab>RUN_VF $*

%.ver:
<tab>RUN_VER $*

So, if I were to do something like:
UNIX> make alltools

Where each *_tool would be dependent on 2 files: dir1/*_tool.vf & dir2/*_tool/subdir2/*_tool.ver.

However, it looks like make only allows one substitution per dependency. So what make actually tries to make are these files (for my_tool):
dir1/my_tool.vf & dir2/my_tool/subdir2/%_tool.ver

'my' did not get substituted into '%' at both places in the second dependency.

So, my question is, can this be done with some other special variable? Or, is there a simple trick to getting around this?

Thanks in advance!
Harlin!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multiple variable substitution in a file in one go

I have a huge script which is defining variables with full path of commands in the beginning of code and using those variables in the script. For Example: ECHO=/bin/echo LS=/bin/ls SED=/bin/sed AWK=/bin/awk UNAME=/bin/uname PS=/bin/ps DATE=/bin/date GREP=/bin/grep $ECHO "hello... (1 Reply)
Discussion started by: veeresh_15
1 Replies

2. Programming

Makefile No rule to make target

I am trying to create a makefile to build a program and am getting the following error: make -f tsimplex.mk make: *** No rule to make target `/main/tsimplex_main.cpp', needed by `tsimplex_main.o'. Stop. OPSYS = $(shell uname -s ) TARGET = tsimplex ROOTDIR = ../../.. GTSDIR =... (1 Reply)
Discussion started by: kristinu
1 Replies

3. Programming

How to define dynamic Target/Prerequisite in Makefile?

I am writing a Makefile for Cobol on Linux.My sample Makefile looks like below. I do not want to Hardcode Program names in Makefile.Is there any way we can mention directories in Target and Prerequisites instead of File names sothat Makefile Pickup all the files in mentioned path as below.... (8 Replies)
Discussion started by: kiranksb
8 Replies

4. Shell Programming and Scripting

MakeFile Backup Target

Goal: I'm trying to create a PHONY target inside my Makefile so that when I run the command "make backup", It will move all the files that end in "~" into the specified backup folder. Here is my code currently, and I'll explain the problem after: .PHONY: backup backup: @mkdir -p... (2 Replies)
Discussion started by: Xploit
2 Replies

5. Solaris

Setting/Modifying variable specific to target in Makefile

Hi, I have a small piece of Makefile script which throw's error on Sun Sparc machine, but works fine with Sun Optron, Linux, AIX machines. FOO=Naveen test1:FOO=Dhilip test1: @echo FOO is ${FOO} test2: @echo Me is ${FOO} Output on Sun Sparc - ukhml-v890new-~/test: make test1... (5 Replies)
Discussion started by: nsriram
5 Replies

6. Shell Programming and Scripting

Multiple variable substitution in one line

Hi, I want to get content of a$i variables with one command: a1=/tmp1.log a2=/tmp2.log for i in 1 2;do log=<some code> echo $log done and get the content of a1 and a2: /tmp1.log /tmp2.log Thanks (2 Replies)
Discussion started by: gdan2000
2 Replies

7. Shell Programming and Scripting

Makefile debug target

Hello, I'm having a problem with a makefile script i'm trying to write. I want to compile a C++ program in two possible ways: "make" (default target, main) and "make debug". When i supply the debug target, exactly the same as main should be built, but then with the DEBUG flag (-g -D... (2 Replies)
Discussion started by: StevenR
2 Replies

8. Shell Programming and Scripting

makefile substitution help

This is driving me crazy. I'm trying to automate some things in my makefile and I'm running into a substitution issue. I'm trying to automatically create object directories if they don't already exist based on the listed source files found in the $(SRCARM) variable. SRCARM = dir1/file1.c \... (0 Replies)
Discussion started by: loki980
0 Replies

9. HP-UX

Oracle 9i install: Error in invoking target install of makefile

I receive an error while installing Oracle 9i: Error in invoking target install of makefile /opt/oracle/product/9.2.0/sqlplus/lib/ins_sqlplus.mk Furthermore: $ whoami oracle $ echo $ORACLE_HOME /opt/oracle/product/9.2.0 $ pwd /opt/oracle/product/9.2.0/sqlplus/lib $ ll total... (5 Replies)
Discussion started by: chris2005
5 Replies

10. Solaris

Makefile:57: *** multiple target patterns. Stop.

Hi, I am getting the following error while building on Solaris 64 , while I am trying to build. Error Snippet :- ---------------------- Makefile:57: *** multiple target patterns. Stop. make: Leaving directory `/work1/patch/vds6053sun64o/vobs/jvi' make: *** Error 2 make: Leaving directory... (0 Replies)
Discussion started by: nileshborate
0 Replies
Login or Register to Ask a Question
SYNCTREE(1)						      General Commands Manual						       SYNCTREE(1)

NAME
synctree - synchronize directory trees. SYNOPSIS
synctree [-iuf] [[user1@]machine1:]dir1 [[user2@]machine2:]dir2 DESCRIPTION
Synctree synchronizes the directory tree rooted at dir2 with dir1. It walks recursively through both trees, and deletes and adds files in dir2 to make it equal to dir1. Mode, owner and group are set for each file unless the -u flag is given. In its normal mode of operation, synctree will ask if it may delete or add directories assuming that you don't want to. Non-directories are simply deleted or added, but synctree will ask if it needs to update a normal file with a default answer of 'y'. Simply typing return will choose the default answer, typing end-of-file is like typing return to this question and all other questions. You can specify a hostname and user-id to be used to access dir1 or dir2. Synctree will use rsh(1) to run a copy of itself on the remote machine. The call interface mimics that of rcp(1), but you can use more than one user@machine prefix if you want to make things really interesting. Hard links are enforced, an update is done by first deleting the old file so that links to unknown files are broken. Links to files within dir2 will be restored. If either directory contains the file .backup, then this file will be used as an alternate inode table. This allows one to make a backup copy of a file tree full of special files and differing user-ids on a remote machine under an unpriviledged user-id. OPTIONS
-i Ask for permission (with default answer 'n') to delete or add any file or directory. -u Only install newer files, i.e. merge the directory trees. -f Don't ask, think 'yes' on any question. SEE ALSO
remsync(1), cpdir(1), rsh(1), rcp(1), perror(3). DIAGNOSTICS
Messages may come from three different processes. One named "Slave" running in dir1, one named "Master" running in dir2, and synctree itself in a mediator role. The mediator will also perform the task of either the master or the slave if one of them is running locally. You need to know this to interpret the error messages coming from one of these processes. The messages are normally based on perror(3). Failure to contact a remote machine will be reported by rsh. Synctree should have a zero exit status if no errors have been encountered. BUGS
Directory dir2 will be created without asking. The master and slave processes get their error output mixed up sometimes (nice puzzle). The local and remote machine must use the same file type encoding. The link replacement strategy may lead to lack of space on a small device. Let synctree run to completion and then rerun it to pick up the pieces. Letting the local process keep its "synctree" name may be a mistake. It talks too much. AUTHOR
Kees J. Bot, (kjb@cs.vu.nl) SYNCTREE(1)