![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Child Killing Parent | mark007 | UNIX for Advanced & Expert Users | 4 | 03-09-2009 01:57 PM |
| How to export a variable from a child process running in background to the parent | aixjadoo | Shell Programming and Scripting | 3 | 11-14-2008 05:35 AM |
| Parent child Relation !! using awk/sed ??? | varungupta | UNIX for Advanced & Expert Users | 0 | 01-29-2008 02:24 PM |
| Parent/Child Processes | yoi2hot4ya | Shell Programming and Scripting | 2 | 05-31-2006 02:27 PM |
| kill parent and child | larry | UNIX for Dummies Questions & Answers | 4 | 01-12-2003 12:18 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Makefile: Parent - Child Inheritance and export
Hi,
I have a number of Makefiles, including a couple of files that I include in Makefiles, a few scripts that are executed through Makefiles, and I have problems with environment variables that are not inherited to the scripts properly. Simplified scenario: rootdir/Makefile: Code:
all:
${MAKE} -C mk alla
Code:
export TARGET:= x86
include rootdir/mk/common.mk
alla:
@echo I am in mk/Makefile
Code:
$(shell ./print_target.sh) Code:
#/bin/bash echo Target is: $TARGET 1>&2 I get Target is: I am in mk/Makefile that is, the shell script did not inherit the TARGET environment variable. However, if I put the export TARGET:= x86 in the root/Makefile instead, then the shell script does inherit the TARGET environment variable, i.e. Target is: x86 I am in mk/Makefile Why is that? And what is the solution? I think I do understand that export will spawn a new child process, thus the makefile where the export is in, can not see it, which is also true for the include as it expands the common.mk.. But I thought that when you run a script, it will also create a child process and it will inherit the export environment variable?? Thanks in advance! |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|