Sponsored Content
Top Forums UNIX for Dummies Questions & Answers MAKE and its macros and variables Post 302187125 by era on Saturday 19th of April 2008 10:23:01 AM
Old 04-19-2008
I don't think you can mix shell and make like that. You can use Make's own constructs for referring to Make's own variables, but by the time the shell actually parses and executes the for loop, things are handled by the shell, and there's no way for that to refer back to Make's internal variables.

Some makes will allow you to export variables to the shell, but this is still going to be rather hard to read, understand, and debug.

Or, you could invoke Make recursively with yet more variables assigned to tell Make which actual variables to use on this invocation. Still more complexity.

Code:
target:
	for system in $(SYSTEM); do $(MAKE) SYS=$$system subtarget; done
subtarget:
	ftp_host=$($(SYS)_FTP_HOST); ... etc

For GNU Make, I could suggest some alternate approaches, but for standard make, I'd just break down and code the whole thing as a shell script, or copy+paste for each SYSTEM.

PS. Please use code tags for legibility.

Last edited by era; 04-19-2008 at 11:30 AM.. Reason: Post brief example; point out [CODE] tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

troff macros

Hi, I'm going write a small handbook. The typesetting software I'm going to use is troff. There are -ms -me -mm macros for troff. Which one is the most suitable? Thanks! -Tony (2 Replies)
Discussion started by: tonyt
2 Replies

2. UNIX for Dummies Questions & Answers

saving macros for VIM

The question is , as the topic says, how does one save macros for VIM in the .vimrc. I had a look on web and it gave all this ****** about how to build turing machines in vim code or something but i just want to store a macro to like : if(){ } I know how to do it IN vim but .vimrc??????!?!?!... (3 Replies)
Discussion started by: yngwie
3 Replies

3. Shell Programming and Scripting

Expect Terminal Macros

Hey people! I just started out working at an ISP as tech support and thought that I should ease the work load by scripting some small macros. I create different commands with Alias through .bashrc which are all directed to the same script file. Here I planned on using Expect to run different... (0 Replies)
Discussion started by: GhettoFish
0 Replies

4. Shell Programming and Scripting

How to make variables in script function local?

Is it possible to make function variables local? I mean for example, I have a script variable 'name' and in function I have declared variable 'name' I need to have script's 'name' have the same value as it was before calling the function with the same declaration. The way to preserve a... (5 Replies)
Discussion started by: alex_5161
5 Replies

5. Linux

What are the meaning of these macros..

Masters, I am trying to learn the serial mouse driver for linux kernel. On the kernel source tree I find out these macros and I am unable to find out the meaning of these macros. Please anyone help me to understand these. These macros are defined in linux/serio.h... (2 Replies)
Discussion started by: iamjayanth
2 Replies

6. UNIX for Advanced & Expert Users

How to make the variables of one script available for the other scripts?

Hello Everyone, I want to know how can we make the variables of one script available for the other script? for example i have three scripts variable_availability.sh,first.sh,second.sh and a file containing variables called common ---------------------------------- cat variable_availability.sh... (2 Replies)
Discussion started by: Kesavan
2 Replies

7. Programming

help with atoi and macros in C

I have a PORT_NUM macro (10 digits long number) in a server file, if i do htons(PORT_NUM) i get warning: this decimal constant is unsigned only in ISO C90 warning: large integer implicitly truncated to unsigned type whats wrong with this? (2 Replies)
Discussion started by: omega666
2 Replies

8. UNIX for Dummies Questions & Answers

I need to make a constant variables to the root

Hello every body, I need to make a constant variable to the root such as #PS1="I am Amer" and so on. I know if i am a user,I can make it fixed from #vi .profile HOW to make it fixed for the root? Thanks in advance BR Ahmed Amer Cairo,Egypt (7 Replies)
Discussion started by: ahmedamer12
7 Replies

9. UNIX for Advanced & Expert Users

Script to make a table from Named Variables.

I need a shell script to make a table from Named Variables Input File(Can have multiple lines): a=1,b=2,d=4,e=5 a=11,b=12,c=13,d=14 Output file: a,b,c,d,e 1,2,,4,5 11,12,13,14, Thanks in advance (7 Replies)
Discussion started by: shariramani
7 Replies

10. Shell Programming and Scripting

Macros how-to?

Hi, all I just came to new system with RH, and it has alot of macros I was told to use, but I can't find how to open it for display or for edit, can you help me please, is it all about make/makefile? let say I have macro <trx> like this, that does a lot of things: >$ trx ... creating new... (1 Reply)
Discussion started by: trento17
1 Replies
DH_AUTO_BUILD(1)                                                     Debhelper                                                    DH_AUTO_BUILD(1)

NAME
dh_auto_build - automatically builds a package SYNOPSIS
dh_auto_build [buildsystemoptions] [debhelperoptions] [--params] DESCRIPTION
dh_auto_build is a debhelper program that tries to automatically build a package. It does so by running the appropriate command for the build system it detects the package uses. For example, if a Makefile is found, this is done by running make (or MAKE, if the environment variable is set). If there's a setup.py, or Build.PL, it is run to build the package. This is intended to work for about 90% of packages. If it doesn't work, you're encouraged to skip using dh_auto_build at all, and just run the build process manually. OPTIONS
See "BUILD SYSTEM OPTIONS" in debhelper(7) for a list of common build system selection and control options. -- params Pass params to the program that is run, after the parameters that dh_auto_build usually passes. SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHOR
Joey Hess <joeyh@debian.org> 11.1.6ubuntu2 2018-05-10 DH_AUTO_BUILD(1)
All times are GMT -4. The time now is 10:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy