Sponsored Content
Top Forums Programming Conditional Compilation based on Environmental Variable in Unix Post 302314115 by BrighterLater on Thursday 7th of May 2009 11:45:54 AM
Old 05-07-2009
Apologies for answering my own question but I think that this is probably a reasonable solution:

Suppose you have an "env var" MY_VERSN

export MY_VERSN=9

In the makefile you can access this as $$MY_VERSN

and add a complier flag

-DMYVER=$$MY_VERSN

Then in the C++ code you can put

#if MYVERSN == 9
iret = routine_A()
#else
iret = routine_B()
#endif

Sorry if I have taken up anyones time.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Environmental Variable

Hi, I'm exporting an environmental variable from a C program using putenv function. I'm calling the exe of the C program from shell script. But when I display the environmental variables from the Shell script, My varaible is not getting displayed. Can anyone please tell me how to get it in... (2 Replies)
Discussion started by: janemary.a
2 Replies

2. Programming

question on conditional compilation

Hey, can I #define something outside the source file ? I have a C program which uses #ifdef.. #ifdef ABC ... do this.. #else ... that ... #endif The usual way that I know of defining ABC is in the source/header file #define ABC But is there any other way to do that ? Maybe as... (2 Replies)
Discussion started by: the_learner
2 Replies

3. UNIX for Advanced & Expert Users

Makefile conditional compilation giving error

Hi , Please answer my query: I want to create a common make file for one of mylibrary such that it should work on both Sun as well as Linux on 32 and 64 bit system. The flow is sth like this: .............. .............. if$(OS) == solaris BINDIR= ../../lib/solaris/64 else BINDIR=... (1 Reply)
Discussion started by: unisuraj
1 Replies

4. Shell Programming and Scripting

setting ksh environmental variable

Hi, I have problem setting up environmental variables. The idea is to start with main.ksh script that will run setting.ksh, and in side of it I'll set up variables. Please take a look at my code, and help me to find my mistake. Thanks, Mila Main.ksh look like this: #!/usr/bin/ksh #... (2 Replies)
Discussion started by: mefquik
2 Replies

5. UNIX for Dummies Questions & Answers

How does the PATH environmental variable work?

Hello. I have a question about how the PATH environment variable works. I wrote a script in $HOME/bin/gvim. I want it to be called instead of /usr/bin/gvim, so I've placed it before in the PATH. However, it is still the old one that is found. If I open an other terminal, I have the... (6 Replies)
Discussion started by: qwer
6 Replies

6. Shell Programming and Scripting

How to get the value of a variable which is having another value in environmental script?

Dear Folks, I am facing an issue in getting a value of a variable.Let me explain the scenario. I am having a list file say files.list in which I have mentioned 1 FILE1 2 FILE2 Then I am having an set_env.ksh in which I mentioned FILE1=/clocal/data/user/userdata.txt... (4 Replies)
Discussion started by: dinesh1985
4 Replies

7. Shell Programming and Scripting

Setting Environmental Variable

I have a request from a programmer to set an env variable for him. I know how to do it for bash shell by adding the following line to .bash_profile export $VAR=/home/code/project/ But this will be applicable only when he is in his bash shell. What is the procedure to be followed to make... (2 Replies)
Discussion started by: Tuxidow
2 Replies

8. UNIX for Advanced & Expert Users

Environmental variable

i want to set environmental variables in solaris and redhat. it should show the current directory and the default shell should be bourne shell. along with it should show the hostname.. like this hostname{/home/vipin/data}# ifconfig Thanks in advanced.:wall: Please use code tags.... (1 Reply)
Discussion started by: vipinkumarr89
1 Replies

9. Shell Programming and Scripting

Clearing a environmental variable

i set a variable from the command line: export GANG="james,roy,martin" i can access this variable ($GANG) from a script. but each time i run the script, the variable keeps getting bigger. more info keeps getting added to it. Is there anyway i can make the $GANG variable contain the... (3 Replies)
Discussion started by: SkySmart
3 Replies

10. Shell Programming and Scripting

Issue with cron and environmental variable

My shell script it.sh.I am calling bip.sh from it.sh #!/bin/sh ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin; export PATH today=`date "+%m-%d-%Y %H:%M:%S"`; export today CUR_DIR=$1; export CUR_DIR LOG_FILE=$CUR_DIR/error.log;... (4 Replies)
Discussion started by: rafa_fed2
4 Replies
SESD(8) 						    BSD System Manager's Manual 						   SESD(8)

NAME
sesd -- monitor SCSI Environmental Services Devices SYNOPSIS
sesd [-d] [-t poll-interval] device [device ...] DESCRIPTION
sesd monitors SCSI Environmental Services (or SAF-TE) devices for changes in state and logs such changes changes to the system error logger (see syslogd(8)). At least one device must be specified. When no other options are supplied, sesd detaches and becomes a daemon, by default waking up every 30 seconds to poll each device for a change in state. The following options may be used: -d Instead of detaching and becoming a daemon, stay attached to the controlling terminal and log changes there as well as via the system logger. -p poll-interval Change the interval of polling from the default 30 seconds to the number of seconds specified. The user may then use getencstat(8) to get more detailed information about the state of the over enclosure device or objects within the enclosure device. FILES
/dev/sesN SCSI Environmental Services Devices SEE ALSO
ses(4), getencstat(8), setencstat(8), setobjstat(8), syslogd(8) BUGS
This is something of a toy, but it is better than nothing. BSD
February 21, 2000 BSD
All times are GMT -4. The time now is 04:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy