makefile

Conditional compilation

How do I add conditional compilation to my makefile: say if I have a #ifdef SAVE_DATA in a cpp (.cc) file. ...

How to use pattern-dependent variables in dependencies in make pattern rules

I'd like to define a GNU make pattern rule with the dependencies in a pattern-dependent variable. What I'd like is something like this: %.exe : $(%_EXE_SOURCES) $(%_EXE_RESOURCES) $(CSC_V)$(CSC) $(CSCFLAGS) $($*_EXE_CSCFLAGS) -target:exe \ -out:$@ $($*_EXE_SOURCES) $($*_EXE_RESOURCES) And to later define something lik...

How to force an error in a gnumake file

Hi, I want to detect a condition in my makefile where a tool is the wrong version and force the make to fail with an error message indicating the item is not the right version. Can anyone give an example of doing this? I tried the following but it is not the right syntax: ifeq "$(shell svnversion --version | sed s/[^0-9\.]*://)" "1.4...

Why is makefile shell result different than doing same in shell?

With a GNU makefile content of: SVNVERSION_NUMBER := $(shell svnversion --version | perl -lne 'print $1 if /version (\d+.\d+.\d+)/') $(error $(SVNVERSION_NUMBER)) I get a result of: Makefile:3: *** svnversion, version 1.6.2 (r37639). Stop. However, at the shell if I type: svnversion --version | perl -lne 'print $1 if /version (\...

Native Makefile alternative for windows

What is a good alternative to Makefile on windows? I'm compiling a collection of c++ files (.cpp's and .h's) using cl.exe. I'd rather not use Makefile, as I want to minimise the amount of 3rd party utilities people will need to build my application. Drew J. Sonne. ...

How to create a .py file for Google App Engine?

Hello everybody!!! I am just at the very start of what I think is gonna be a long journey exploring the world of applications in Google App Engine using Python. I have just downloaded Python 2.6.4 from the Python official website and installed it on my computer (I am using Windows XP). I also downloaded the App Engine Python software ...

Tricky makefile syntax with quotes

Hello, I have the following start on a makefile rule (thanks to help from others), but it doesn't quite work yet: test_svn_version: @if [ $$(svn --version --quiet \ perl -ne '@a=split(/\./); \ print $$a[0]*10000 + $$a[1]*100 + $$a[2]') \ -lt 10600 ]; \ then \ echo >&2 "Svn ve...

makefile/nmake : strip out folder bits from the file list

I have a makefile (using nmake & VC++ 2005): CPP_OBJS = $(CPP_SOURCE:.cpp=.obj) $(TARGET) : $(CPP_OBJS) $(link) $(ldebug) $(lflags) /DLL \ $(LIBPATHS) \ $out:$@ $(CPP_OBJS) $(conlibs) The problem is link step fails because $(CPP_OBJS) are expanded into the list of files where each filename is prepended with a folder name...

Makefile rule to check svnversion result

Trying to make a makefile rule to check that svnversion gave a proper result. Normally, it should return something like one of the following: 1023:1055M 1056 However, it can get an error like: svn: This client is too old to work with working copy '.'; please get a newer Subversion client So here is my version of the rule based on ...

How to conditionalize a makefile based upon grep results?

I'm looking for a way to bail out of a makefile if a certain string is not found when checking the version of a tool. The grep expression I'm looking to match is: dplus -VV | grep 'build date and time: Nov 1 2009 19:31:28' which returns a matching line if the proper version of dplus is installed. How do I work a conditional into my...

Where does the -DNDEBUG normally come from?

Hi, Our build system has somehow changed such that optimized builds are no longer getting the -DNDEBUG added to the compile line. I searched our makefiles and don't find this. So the question is, where does -DNDEBUG originate for most people and how might that have changed? Before we did have -DNDEBUG and I don't think this was remov...

C++ preprocessor variable

Hi guys I'm using the SKELETON_JAR variable on my c++ code in one header. However I want to allow the user to define the place of the jar in the compile time easily. I think the easiest way to do that is to put this define in makefile is that so? #define SKELETON_JAR "./Util.jar" ?? ...

How to make two different source directories in a Makefile output to one bin directory?

I have the following Makefile to build my erlang project: .SUFFIXES: .erl .beam .yrl ERL_SRC := $(wildcard src/*.erl) ERL_OBJ := $(patsubst src/%.erl,ebin/%.beam,${ERL_SRC}) all: main main: ${ERL_OBJ} ebin/%.beam: src/%.erl erlc +debug_info -W -o ebin $< clean: rm -fr ebin/*.beam I'm trying to update this to also ...

makefile with directory tree creation suitable for parallel (-j ) build

My project needs temporary directories which are created during the build using mkdir -p similarly to this: all: dirtree $(OBJFILES) dirtree: @mkdir -p $(BUILD)/temp_directory But this approach cannot be used with the -j switch, because first of the OBJFILES get compiled before the mkdir target is made. Is there a standard way t...

Any existing pure PHP "make" tools?

Let me elaborate on the question... I have a custom CMS (built on codeigniter FTW) that includes many different types of modules. Every time we have a new project come through the door, it is a variation and amalgamation of a few of the existing modules. Sometimes a project comes through with requirements that are not satisfied ...

fpcmake and Makefile.fpc, where can I get some training?

I've never used any of these, but they are listed on the main Free Pascal site and I would really like to get my hands on: Beginners guide, to get me started Advanced guide, to help me grow All this in case it's still used/standard. Thanks ...

Compiling on Linux and Mac OSX: Working with Xcode build and make?

I'm writing a plain C project. I'm using a Mac and I like working with Xcode and I want to use the Xcode project and build environment. I'd like to be able to build it on other platforms though. Not being overly familiar with Linux (yet) I assume this would involve a makefile. My project has no dependencies and it's about as vanilla as i...

Define make variable at rule execution time

In my GNUmakefile, I would like to have a rule that uses a temporary directory. For example: out.tar: TMP := $(shell mktemp -d) echo hi $(TMP)/hi.txt tar -C $(TMP) cf $@ . rm -rf $(TMP) As written, the above rule creates the temporary directory at the time that the rule is parsed. This means that, even I don'...

Add Jar File to Buildpath in Windows Command Line

Hi Im quite annoyed at having to ask this but I cant get it to work. Currently I have a project with: 5 Classes in the src/ folder 2 JARS named profiles.jar and classifier.jar in the root folder I want to create a "makefile?" or "batch file?" to compile and run these classes FROM THE WINDOWS COMMAND LINE, but first add the ...

"Undefined Reference" Error From ld

Hi there! This isn't as naive as the title may lead you to think. I receive an "Undefined Reference" Error from the linker/ld for a couple of function symbols in third party shared library, that I'm trying to link with my executable. The strange part is, that library itself is supposed to contain the definition for the offending symb...