Sponsored Content
Full Discussion: Makefile - If Statement?
Top Forums Shell Programming and Scripting Makefile - If Statement? Post 302279876 by drl on Saturday 24th of January 2009 12:59:43 PM
Old 01-24-2009
Hi.

It helps if you say more than: I can't get it to run, versions, etc.

So, for this script:
Code:
#!/usr/bin/env bash

# @(#) s1       Demonstrate ifeq in make, with, without parens.

echo
set +o nounset
LC_ALL=C ; LANG=C ; export LC_ALL LANG
echo "Environment: LC_ALL = $LC_ALL, LANG = $LANG"
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1) make
set -o nounset
echo

FILE=${1-Makefile}

echo " Data file $FILE:"
cat $FILE

echo
echo " Results:"
make

exit 0

We get:
Code:
% ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.11-x1, i686
Distribution        : Xandros Desktop 3.0.3 Business
GNU bash 2.05b.0
GNU Make 3.80

 Data file Makefile:
# Sat Jan 24 11:25:44 CST 2009

file:
        @echo
        @echo " No parens, whitespace ignored."
  ifeq    "a"    "a"
        @echo " Strings are equal."
  else
        @echo " Strings differ."
  endif
        @echo
        @echo " With parens -- tricky comparison of whitespace."
  ifeq ( "a", "a" )
        @echo " Strings are equal."
  else
        @echo " Strings differ."
  endif

 Results:

 No parens, whitespace ignored.
 Strings are equal.

 With parens -- tricky comparison of whitespace.
 Strings differ.

You can google for examples or read GNU Make Manual - GNU Project - Free Software Foundation (FSF) or try:
Quote:
Title: Managing Projects with GNU Make
Author: R Mecklenburg
Edition: 3rd
Date: 2004
Publisher: O'Reilly
ISBN: 0-596-00610-1
Pages: 280
Categories: *nix, development, compiling, building, programming, tools
Comments: Visit O'Reilly Media | Spreading the knowledge of technology innovators to get the
Comments: corrections for a large number of errors.
Comments: GNU manual: GNU `make'
Comments: 43 page tutorial: http://www.cs.utah.edu/classes/cs563...mentsOfMake.ps
Comments: Conflicting opinions amazon.com; 4 stars, 8 reviews, 2007.05.
Comments: see also cons, scons
cheers, drl
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

makefile

Can anyone tell me what does ?= do example VARIABLE ?= /somepath This is being used in makefile (1 Reply)
Discussion started by: raagbansal
1 Replies

2. UNIX for Dummies Questions & Answers

makefile

I'm new to the admin world, and I'm trying to install the GNU C Compiler to work on my project. I got the source code, and was able to configure it. Most of the info I've read tells me the next step is to run a command called "make". when I run it, I get a "command not found" message. I've... (4 Replies)
Discussion started by: ECBROWN
4 Replies

3. Shell Programming and Scripting

If statement - How to write a null statement

In my ksh script, if the conditions of a if statement are true, then do nothing; otherwise, execute some commands. How do I write the "do nothing" statement in the following example? Example: if (( "$x"="1" && "$y"="a" && "$z"="happy" )) then do nothing else command command fi... (3 Replies)
Discussion started by: april
3 Replies

4. Shell Programming and Scripting

How is use sselect statement o/p in insert statement.

Hi All, I am using Unix ksh script. I need to insert values to a table using the o/p from a slelect statement. Can anybody Help! My script looks like tihs. ---`sqlplus -s username/password@SID << EOF set heading off set feedback off set pages 0 insert into ${TB_NAME}_D... (2 Replies)
Discussion started by: nkosaraju
2 Replies

5. 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

6. Programming

Makefile help

I've copied a C++ project from my old computer to this one, and I am now trying to (without success) compile the project in the same way as I did before. I use Emacs as a text editor and compile with g++. Here is what my makefile looks like: CC=g++ CPPFLAGS=-Wall CPPFLAGS+=-I..... (4 Replies)
Discussion started by: TriKri
4 Replies

7. 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

8. 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

9. Shell Programming and Scripting

Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks, I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex. I have a bunch of update statements with all columns in a file which I need to convert into insert statements. UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies

10. 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
PPI::Statement::Null(3) 				User Contributed Perl Documentation				   PPI::Statement::Null(3)

NAME
PPI::Statement::Null - A useless null statement SYNOPSIS
my $foo = 1; ; # <-- Null statement my $bar = 1; INHERITANCE
PPI::Statement::Null isa PPI::Statement isa PPI::Node isa PPI::Element DESCRIPTION
"PPI::Statement::Null" is a utility class designed to handle situations where PPI encounters a naked statement separator. Although strictly speaking, the semicolon is a statement separator and not a statement terminator, PPI considers a semicolon to be a statement terminator under most circumstances. In any case, the null statement has no purpose, and can be safely deleted with no ill effect. METHODS
"PPI::Statement::Null" has no additional methods beyond the default ones provided by PPI::Statement, PPI::Node and PPI::Element. SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.18.2 2011-02-25 PPI::Statement::Null(3)
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy