473,624 Members | 2,005 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 3542
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
3478
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 Microsoft VM. But when I use Suns' VM the applet hangs after opening the dialog. And you have to
2
3014
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 filestructure should be like that: project_dir/ source_dir/ main.cpp
1
1816
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
6114
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 understand Finally runs whether an error was caught or not, I haven't found a use for finally yet.
10
3666
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
3680
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 try/except. Neither is perfect yet, but I was wondering which I should try for in the first place. I figure I need to check for an emptry string, non-numeric strings (maybe these are the same check), 0 and negative numbers (which might also fall into...
4
3952
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
4080
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 statement. I am going to post the first 82 lines of the script, since the error message points at line 80: from abaqusConstants import * from abaqus import *
8
3192
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 following files describing 4 classes (A, B, C1, C2) and a test program (test.cpp) which runs a test for classes C1 and C2. A.h A.cpp
1
5034
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 auto generated one. the following is the given Makefile, ***************************************************************** CC = gcc INCS = -I. CFLAGS = -g -Wall $(DEFS) $(INCS)
0
8236
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8173
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2606
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1482
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.