make

How do I run a Perl one liner from a makefile?

I know the perl one liner below is very simple, works and does a global substitution, A for a; but how do I run it in a makefile? perl -pi -e "s/a/A/g" filename I have tried (I now think the rest of the post is junk as the shell command does a command line expansion - NOT WHAT I WANT!) The question above still stands! APP = $(shell p...

Append to GNU make variables via command line

I am using a GNU-make Makefile to build a C project with several targets (all, clean, and a few project specific targets). In the process of debugging, I would like to append some flags to a single build without permanently editing the Makefile (e.g. add debugging symbols or set a preprocessor flag). In the past, I have done that as fol...

Can you make valid Makefiles without tab characters?

target: dependencies command1 command2 On my system (Mac OS X), make seems to require that that Makefiles have a tab character preceding the the content of each command line, or it throws a syntax error. This is an annoyance when creating or editing Makefiles because I have my editor set up to be all-spaces-all-the-time. Can ...

Merits of bmake

Apart from the fact that bmake is an BSD equivalent of GNU make, I could not clearly understand it's advantages over GNU make. Can anyone help me? I was able to find only one resource that was bit helpful. More help or pointers are appreciated. Thanks, Prabhu ...

What's the real utility of make and ant?

While i'm developing in C/C++ and Java, i simply make a compile.bat script that does everything, that's fine for me. Why should i use make and why should i use ant? ...

What is the purpose of .PHONY in a makefile?

What does .PHONY mean in a Makefile? I have gone through this, but it is too complicated. Can somebody explain it to me in simple terms? ...

How can I profile a complete C++ build?

Hi, I'm developing an application in C++ on Windows XP, using Eclipse as my IDE, and a Makefile-based build system (with custom tools to generate the Makefiles). In addition, I'm using LZZ, which allows me to write a single file, which then gets split into a header and an implementation file. I'm using TDM's port of GCC 4. What tools o...

Building Cairo for Windows with MinGW (Problems linking libpng)

I'm trying to build cairo on Windows using MinGW (and MSYS). I am following the instrucions on Compiling GTK+ 2.16.4 for Windows, except that I'm using the latest versions whenever possible, i.e: zlib-1.2.3 libpng-1.2.42 pixman-0.17.4 cairo-1.8.8 This works pretty well up until when I try to build the actual cairo. The configuration ...

Make "make" default to "make -j 8"

Is there a way that I can make $ make default to: $ make -j 8 ? Thanks! ...

How can I reliably test for Snow Leopard inside a Makefile?

I've got to tweak my build just slightly on Snow Leopard, how can I easily test the platform? uname -a doesn't seem to be returning anything particularly helpful. ...

How can I force make to exit if compiling one dependency fails?

I've posted the relevant bits of my makefile. When I run make all on this makefile, there's a compilation error when compiling debugosd.o. However, because make found a previously built debugosd.o, it just continues on to build dialup.otz. Without deleting all the .o's, how can I force debugosd.o to become out-of-date - and so force ma...

Using pkg-config with autotools

I'm learning about the autotools and made it through a hello world scenario and now wanted to try wrapping up some cppunit tests into a package and build it using the autotools. In order to build the package, cppunit would have to be installed on the system. What's the best way to check for this during the ./configure portion of the bu...

Comprehensive gnu make / gcc tutorial

I've just started learning C++ and I find it very hard to find short, comprehensive tutorials on how to use gnu make / gcc. Any ideas (please don't point me to the official gnu make tutorial, it's way too much in-depth for my purposes ;-)). ...

Make computes wildcard too early?

I have a make file of, more or less, the following structure that compiles C++ source code: .PHONY: all all: compile_obj_files my_binary # This rule generates the object files. It works fine afaik. .PHONY: compile_obj_files compile_obj_files: $(MAKE) --file=child.makefile # my_binary is a real binary file that I wish to build. my_...

How to have gnu make continue after error?

After years of not using make, I find myself needing it again, the gnu version now. I'm pretty sure I should be able to do what I want here, but haven't figured out how, or found an answer with Google, etc. I'm trying to create a test target which will execute my program a number of times, saving the results in a log file. Some tests ...

Conditional dependency with make/gmake

Is there a way to direct make/gmake to act upon conditional dependencies? I have this rule in place: $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(CPPC) -c $(FLAGS_DEV) $< -o $@ In the general case, every .cpp file has a corresponding .h file; however there are a few exceptions. Is there a way to achieve "depend on this if it exists" with gm...

Makefile calling another makefile

I'm getting some unexpected results calling one makefile from another. I have two makefiles, one called /path/to/project/makefile and one called /path/to/project/gtest-1.4.0/make/Makefile. I'm attempting to have the former call the latter. In /path/to/project/makefile, I have dev: $(OBJ_FILES) $(CPPC) $(LIBS) $(FLAGS_DEV) $(OBJ_FIL...

apt-get environment variables when spawning "debian rules" file

What are the environment variables made available to debian/rules (often make) when spawned by apt-get during installation of a package under Ubuntu? I am specifically after the environment variables that would pertain to Gnome's configuration directories. I'd like avoiding "hardcoding" things like ~/.conf/apps/ ... since I have been to...

pkg-config: platform-neutral way to find out where to install my .pc file?

How do I know where to install my .pc file? These files are put in different places on different operating systems. The goal is to be able to use something like $(INSTALL) mylib.pc $$(pkg-config --pcdir) in the install target. I thought pkg-config would be able to tell me somehow, but can't find anything. I'm looking for a "standalon...

Rectifying autogenerated dependencies (from gcc) in make

I have the following makefile (fragment) SRC_DIR = src OBJ_DIR = obj DEP_DIR = dep BIN_DIR = . SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp) OBJ_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES)) DEP_FILES := $(patsubst $(SRC_DIR)/%.cpp,$(DEP_DIR)/%.d,$(SRC_FILES)) # Development build directive dev: $(DEP_...