Help needed - How to use or condition in makefile


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help needed - How to use or condition in makefile
# 1  
Old 03-01-2011
Help needed - How to use or condition in makefile

Hi All,
i get struck in between how to use OR condition in makefile.
Eg:
ifeq ($(PACKAGE),x)
LIBS += $(STRIPPED_LIB-ONLY)
else
ifeq ($(PACKAGE),y)
LIBS += $(STRIPPED_LIB-ONLY)
else
LIBS += $(LIB-ONLY)
endif
endif

so if we look into above syntax i have used if else condition twice. is there any possibility of using OR conditional in makefile ? like below...
ifeq ($(PACKAGE),(x | y)
LIBS += $(STRIPPED_LIB-ONLY)
else
LIBS += $(LIB-ONLY)
endif

please help me in how to use OR conditional statement in makefile. from GNU manual i didnt get clear picture of how to use the syntax.

Thanks in Advance

Regards,
Dhanavel
# 2  
Old 03-01-2011
I do not see the | being OR in this context.

Conditional Syntax - GNU `make'
GNU make - Conditional Parts of Makefiles

They do note that you can do OR-ish things using string functions like filter inside ifeq and his friends:

GNU make - Functions for Transforming Text

Do not work hard at terse, go for clear as day.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Makefile for g++

Hi All, We have moved our OS from Sun Solaris to Linux and also some of the compilers. Our old makefile used to be as below: CC=cc FLAGS=-G -KPIC -DLG_SOLARIS_OS DEFINES=-DSunOS SYSLIBS=-lc .SUFFIXES : .c .c.o : ;$(CC) -c $(FLAGS) $(DEFINES) $*.c -o $*.o ... (3 Replies)
Discussion started by: shash
3 Replies

2. Shell Programming and Scripting

If condition return 0 even when it fails to satisfy te condition

HI My doubt may be basic one but I need to get it clarified.. When i use "if" condition that checks for many AND, OR logical conditions like if ]; then return 0 fi Even the if condition fails it returns as zero.. Any clue.. But if i add else condition like if ]; ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

3. Shell Programming and Scripting

redirect stdout echo command in condition A run in condition B

hi, I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command Here are my simple script After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
Discussion started by: jao_madn
3 Replies

4. HP-UX

Difference between [condition] and [[condition]] and ((condition)) when used with if condition

Executed the following if conditions .. and got different results . only (( )) gave correct o/p with all scenarios . Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition. And why each condition gave different result. 1.... (2 Replies)
Discussion started by: soumyabubun
2 Replies

5. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

6. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

7. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

8. Programming

Makefile

I am writing my first makefile, and I face a problem: all: sequential pthreads1 pthreads2 openmp1 openmp2 sequential: sequential/main.c sequential/definitions.h gcc -o seq sequential/main.c pthreads1: pthreads1/main.c pthreads1/definitions.h gcc -o pthr1 pthreads1/main.c -lpthread ... (0 Replies)
Discussion started by: myle
0 Replies

9. Shell Programming and Scripting

Help Needed in Date Condition !!

I am writing an shell script , which reads a file with contents Example :: (( This Format is yyyy-MM-DD)) 2008-05-16 2008-05-17 2008-05-18 2008-05-19 2008-05-20 2008-05-21 when i run the shell script it has to check the current date and compare it with the todays date and give me... (24 Replies)
Discussion started by: ranga27
24 Replies

10. Programming

Makefile

I m using SUN Studiuo11 compiler.There is problem while building Makefile. I got error as dmake:fetal error command failed for target plz help me. (7 Replies)
Discussion started by: NamrataGurav
7 Replies
Login or Register to Ask a Question