473,499 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set if else within a flag for a makefile

38 New Member
Do i have any possibility to set if/else within a flag which contains a coupile of libraries. COnsider this example:

FLAG -L$(LIBRAY1_DIR) -L$(LIBRAY2_DIR) -llibrary1 - library2

What i want do to do is for some compilation i want to include the second library - library2 and for other compilation i do not want to include it.

I have done as the following(i am a beginner with Make). But it did not work at all.

FLAG -L$(LIBRAY1_DIR) -L$(LIBRAY2_DIR) \
- library1 \
ifdef$(VARIABLE) \
-llibrary1 \
endif

How can i automazie this action?
Apr 8 '10 #1
7 3530
donbock
2,426 Recognized Expert Top Contributor
Which version make are you using?

How do you want to tell make which option to take?
(for instance, command line argument, different make targets, something else)
Apr 8 '10 #2
mar11
38 New Member
I have the version 3.81

If there are more than one possibility to choose specific compiler-flag as i have described then i will appreciate to get some of suggestions.
Apr 9 '10 #3
donbock
2,426 Recognized Expert Top Contributor
Sorry I wasn't clear. There are many different make programs out there. Which one are you using?

Version number 3.81 is consistent with gnu make.
Apr 9 '10 #4
mar11
38 New Member
Sorry, I still do not understand you what do you actually want to know!!

I think my question was clear enough as i described above. please can you read it again..

any suggestions...
Apr 10 '10 #5
newb16
687 Contributor
did you try to search for 'gnu make conditional' in google?
Does something like this work?
Expand|Select|Wrap|Line Numbers
  1. ifdef FLAG
  2.   libs2 = -library2
  3. else
  4. # or leave it empty?
  5.   libs2 = 
  6. endif
  7.  
  8. FLAG -L$(LIBRAY1_DIR) -L$(LIBRAY2_DIR) -library1 $(libs2)
  9.  
Apr 11 '10 #6
donbock
2,426 Recognized Expert Top Contributor
There are many different make programs in use today. How they support conditional instructions varies. If I don't know which make program you are using then I might give you the wrong advice.
Apr 13 '10 #7
mar11
38 New Member
@donebock

let us make the life more easy and tell me please how can i check which make Program do i use...
Apr 14 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3472
by: Michael | last post by:
Hello Currently I'm migrating an applet from Java 1.1 to 1.3. Targetplattform: Microsoft Internet Explorer 5.x with Sun's Java VM 1.3.1 Problem: The attached applet works fine with the...
2
3002
by: Juhan Voolaid | last post by:
Hello I need help with my makefile, so that when I compile my project the source code files would be separated from the object (*.o) files. So if I have: main.cpp and classes.cpp - the...
1
1809
by: just80n | last post by:
Hi, I dont know if it is possible, but I would like to be aware of which version of gcc is beeing used from within my Makefile (under Linux). Sorry if this was asked before
32
6083
by: cj | last post by:
Another wish of mine. I wish there was a way in the Try Catch structure to say if there wasn't an error to do something. Like an else statement. Try Catch Else Finally. Also because I...
10
3655
by: Nader | last post by:
Hello, I'd like to send command or message within access to other users who are connected to the same mdb file. Is that possible ? thanks in advance. Nader
4
3669
by: John Salerno | last post by:
My code is below. The main focus would be on the OnStart method. I want to make sure that a positive integer is entered in the input box. At first I tried an if/else clause, then switched to...
4
3937
by: Jess | last post by:
Hello, I am now trying to use makefile to compile C++ programs. My makefile looks like: f1.o : f1.cpp h1.h h2.h g++ -c f1.cpp f2.o : f2.cpp h2.h h3.h g++ -c f2.cpp
2
4068
by: juan-manuel.behrendt | last post by:
Hello together, I wrote a script for the engineering software abaqus/CAE. It worked well until I implemented a selection in order to variate the variable "lGwU" through an if elif, else...
8
3182
by: xz | last post by:
I am a rookie of C++ and got so confused with the Makefile these days. Could anyone be so kind and give a little sample Makefile for the following particular example? Let's say I have the...
1
5020
by: rpjanaka | last post by:
I am using an open source library called IGI_UDP for measure the available bandwidth of a link (http://www.cs.cmu.edu/%7Ehnn/igi/ ). with that library they have provided a "Makefile" which is not an...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7012
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7392
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.