Sponsored Content
Full Discussion: [Solved] makefile conditions
Top Forums Programming [Solved] makefile conditions Post 302476227 by robfwauk on Wednesday 1st of December 2010 06:24:16 AM
Old 12-01-2010
[Solved] makefile conditions

Hi Everyone,

I'm trying to write a makefile that has two options. 1. A make all that shall believe it or not make everything :P and 2. a make without option.

I need to setup a few arrays differently, depending on the option choosen i.e. all or without.

My first try consisted of me creating a file "without"

e.g.

without:
touch without
make

then testing for that file using wildcard. I could not get this to work and it didnt even look like it was falling into the else condition.

So, attempt number two. I was thinking of creating a function similar to that of a shell script but from what i have read, this is not possible and i saw reference to something like this:-

without = \
@echo -e "Making Airsurf [Without PIF]"
VPATH = $(APP_C):$(IMS_C):$(COM_C)
CCP = g++ -Wall -O2 -DMENU -DCPU=I80386 -Wno-deprecated -Wno-write-strings -Wno-non-virtual-dtor -DUSEMYSQL -DUSESDL

then inside the actual rule:-

without:
$(call, without)

This also did not work, and variables never seemed to get set, or i would end up in an infinite loop.


Can anyone explain where i maybe going wrong or throw some ideas of what else may work my way? In theory this is a simple problem

if running make 1: set these variables else set variables to this instead.

Hope this post makes some sense Smilie

Thanks In Advance Smilie
 

10 More Discussions You Might Find Interesting

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

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

3. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

4. Shell Programming and Scripting

IF OR with two conditions

I have this IF working fine, testing if a char is a digit: if ; then _VALUE=$_VALUE$_CHAR else _ISDIGIT="false" fi Then I add a second condition to test if the char is either a digit or a * if ]; then _VALUE=$_VALUE$_CHAR ... (11 Replies)
Discussion started by: Flavius
11 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. Shell Programming and Scripting

If conditions need

Dear Expert, Below code is for to take the backup of database by daily time stamp. I need vital help to make my script automatic sending me email if it sucess or fail. echo on @REM Seamonkey's quick date batch (MMDDYYYY format) @REM Setups %date variable @REM First parses month, day, and... (6 Replies)
Discussion started by: Alone
6 Replies

7. Shell Programming and Scripting

Errors in if conditions with to many OR conditions

Hi ALL I have a script where in i need to check for several values in if conditons but when i execute the script it throws error such as "TOO MANY ARGUMENTS" if then msg="BM VAR Issue :: bmaRequestVAR=$bmaRequestVAR , nltBMVAR=$nltBMVAR , bmaResponseVAR=$bmaResponseVAR ,... (10 Replies)
Discussion started by: nikhil jain
10 Replies

8. Shell Programming and Scripting

[Solved] Command execution in Makefile

Linux Gurus, I have a query regarding the execution of a complex command in the makefile of the current system. I am currently using shell command in the makefile to execute the command. However my command fails as it is a combination of a many commands and execution collects a huge data...... (4 Replies)
Discussion started by: satishkumar432
4 Replies

9. Shell Programming and Scripting

Conditions in if

I'm using the below one.. #!/bin/ksh File=$3 if ; then echo "Script" elif ] ;then echo "Passed k or f option" else "Please check the Input passed" fi Command line argument is "k" or -f and file is exist then... (3 Replies)
Discussion started by: Roozo
3 Replies

10. Shell Programming and Scripting

GNU & BSD Makefile Directives & Conditions Compatibility

Firstly, I would like to apologize if this is not the appropriate sub-forum to post about GNU/BSD makefile scripting. Though my code is in C++, because I am focusing on the makefile I thought it would go better in shell scripting. Please correct me if I am wrong. Secondly, I am not interested in... (0 Replies)
Discussion started by: AntumDeluge
0 Replies
SDCPP(1)						      General Commands Manual							  SDCPP(1)

NAME
sdcpp - C preprocessor for SDCC SYNOPSIS
sdcppold [options] filename DESCRIPTION
This manual page documents briefly the sdccp command. This manual page was written for the Debian GNU/Linux distribution because the orig- inal program does not have a manual page. Instead, you can read the documentation in /usr/share/doc/sdcc-doc. SDCC is a Freeware, retargettable, optimizing ANSI-C compiler designed for 8 bit Microprocessors. OPTIONS
-include <file> Include the contents of <file> before other files. -imacros <file> Accept definition of macros in <file>. -iprefix <path> Specify <path> as a prefix for next two options. -iwithprefix <dir> Add <dir> to the end of the system include path. -iwithprefixbefore <dir> Add <dir> to the end of the main include path. -isystem <dir> Add <dir> to the start of the system include path. -idirafter <dir> Add <dir> to the end of the system include path. -I <dir> Add <dir> to the end of the main include path. -I- Fine-grained include path control; see info docs. -nostdinc Do not search system include directories (dirs specified with -isystem will still be used). -nostdinc++ Do not search system include directories for C++. -o <file> Put output into <file>. -pedantic Issue all warnings demanded by strict ISO C. -pedantic-errors Issue -pedantic warnings as errors instead. -trigraphs Support ISO C trigraphs. -lang-c Assume that the input sources are in C. -lang-c89 Assume that the input sources are in C89. -lang-c++ Assume that the input sources are in C++. -lang-objc Assume that the input sources are in ObjectiveC. -lang-objc++ Assume that the input sources are in ObjectiveC++. -lang-asm Assume that the input sources are in assembler. -std=<std name> Specify the conformance standard; one of: gnu89, gnu99, c89, c99, iso9899:1990, iso9899:199409, iso9899:1999 -+ Allow parsing of C++ style features. -w Inhibit warning messages. -Wtrigraphs Warn if trigraphs are encountered. -Wno-trigraphs Do not warn about trigraphs. -Wcomment{s} Warn if one comment starts inside another. -Wno-comment{s} Do not warn about comments. -Wtraditional Warn about features not present in traditional C; -Wno-traditional Do not warn about traditional C; -Wundef Warn if an undefined macro is used by #if. -Wno-undef Do not warn about testing undefined macros. -Wimport Warn about the use of the #import directive. -Wno-import Do not warn about the use of #import. -Werror Treat all warnings as errors. -Wno-error Do not treat warnings as errors. -Wsystem-headers Do not suppress warnings from system headers. -Wno-system-headers Suppress warnings from system headers. -Wall Enable all preprocessor warnings. -M Generate make dependencies. -MM As -M , but ignore system header files. -MF <file> Write dependency output to the given file. -MG Treat missing header file as generated files. -MP Generate phony targets for all headers. -MQ <target> Add a MAKE-quoted target. -MT <target> Add an unquoted target. -D<macro> Define a <macro> with string '1' as its value. -D<macro>=<val> Define a <macro> with <val> as its value. -A<question> (<answer>) Assert the <answer> to <question>. -A-<question> (<answer>) Disable <answer> to <question>. -U<macro> Undefine <macro>. -H Print the name of header files as they are used. -C Do not discard comments. -dM Display a list of macro definitions active at end. -dD Preserve macro definitions in output. -dN As -dD except that only the names are preserved. -dI Include #include directives in the output. -fpreprocessed Treat the input file as already preprocessed. -ftabstop=<number> Distance between tab stops for column reporting. -P Do not generate #line directives. -$ Do not allow '$' in identifiers. -remap Remap file names when including files. -v or --version Display the version number. -h or --help Show summary of options. AUTHOR
This manual page was written by Aurelien Jarno <aurel32@debian.org>, for the Debian GNU/Linux system (but may be used by others). SDCPP(1)
All times are GMT -4. The time now is 07:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy