make

cmake, print compile/link commands

Can somebody please enlighten me as to what the command line flag to CMake might be that will make it print out all the compile/link commands it executes? I can't find this anywhere in the documentation. Many hours of my life have just evaporated. I'd just like to verify it's doing what I think it is, (then banish the infernal build sys...

Detecting (non-)GNU Make when someone runs `make`

I have a project whose makefile uses features exclusive to GNU Make. Sadly, there are platforms we must support where GNU make is still not the default when running make. One of my colleagues was bitten by this, when a non-GNU make implementation silently failed to build our code correctly (it expanded an automatic variable to an empty ...

Why can I not override make's environment variables in FreeBSD's apache port?

I'm trying to configure Apache 2.2 from ports (in FreeBSD). I've written my own makefile with my desired compile options and as far as I can tell, everything seems to check out. I.e.: make -V <env_var> __MAKE_CONF=~/mk/make.apache22.conf returns what I expect except for PERL5 and USE_PERL5. I've tried setting both variables in make....

Suppress "nothing to be done for 'all' "

I am writing a short shell script which calls 'make all'. It's not critical, but is there a way I can suppress the message saying 'nothing to be done for all' if that is the case? I am hoping to find a flag for make which suppresses this (not sure there is one), but an additional line or 2 of code would work too. FYI I'm using bash. Ed...

What is the difference between building C++ Builder project from IDE and command line?

Hello, I have different behaviour of compiler, when building project from IDE and from command-line, which I can not explain. The detailed issue's description is rather big, but it's really simple. I have a C++ Builder project, which has a PAS-file included (IncludeUnits.pas). This pas-file has several units and inc-files listed. Th...

How to detect header changes in make dependency list

After almost a decade of C# and VC++ coding, I am getting back to a linux – g++ - make – emacs environment. Trying to refresh my memory about writing a make file I did not have many problems, but I stumbled in the following issue, that I admit I do not remember how I solved it in the past: Let’s say that a particular .cpp file have ...

What do @, - and + do as prefixes to recipe lines in Make?

In the GNU Makefile manual, it mentions these prefixes. If .ONESHELL is provided, then only the first line of the recipe will be checked for the special prefix characters (‘@’, ‘-’, and ‘+’). What do these prefixes do, and where are they mentioned? ...

Suppress make rule error output

I have an rule that creates a directory bin: -mkdir $@ However after the first time the directory has been generated, I receive this output: mkdir bin mkdir: cannot create directory `bin': File exists make: [bin] Error 1 (ignored) Is there some way I can only run the rule if the directory doesn't exist, or suppress the output w...

Are makefiles Turing complete?

Lately at work, I've been doing some translation from Makefiles to an alternative build system. I've seen some pretty hairy Make code in some places using functional map, filter, and foreach constructs. This surprised me since I think build scripts ought to be as declarative as possible. Anyway, this got me thinking: is the Makefile lan...

Compile other external libraries (without CMakeLists.txt) with CMake

short -- Is it possible to build a external binary/library out of a project with CMake, when the binary/library only has a makefile given? So you have your own project, a bunch of CMakeLists.txt in your src-tree and this external library with its source-files. Your sources depend on this library and some binaries/libraries want to link ...

Cross-Compiling gcc

I am following the instructions here for cross-compiling GCC. I am on a mac. When I run this command from the gcc source folder: ./configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --without-headers --enable-languages=c,ada,c++,fortran,java,objc,obj-c++,treelang I get this error: configure: error: GMP 4.1 and MPFR 2.2.1...

Win7 MInGW QT MySQL program screams "cannot find -lqsqlmysqld"; where is the missing library?

Hello everyone. I am attempting to make a qt program on Windows 7 that uses a MySQL plugin. I have compiled both qt and the mysql plugin with no problems using my minGW 32bit compiler. However, I keep on getting an error like this: mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory `C:/Users/dhatt/Desktop/testdb2' g++...

Subdirectories and Makefiles

I think this is a question that has been asked many times but I cannot find the right way to do it. I have the following structure: project/ project/Makefile project/code project/code/*.cc project/code/Makefile When I am in the directory 'project/code' and call "make project_code" my code is compiling correctly. I would like to do t...

white space free path to My Documents

Hello All, In building a C++ project with the GNU tool chain, make tells me ~ src/Adapter_FS5HyDE.d:1: * multiple target patterns. Stop. Search, search, search, and I found out that make thinks that it has multiple targets because the path to my included headers has spaces in it. If you've got your headers stored in some sane p...

GCC cant find GMP, MPFR and MPC libraries

I am trying to cross-compile GCC on Mac OS 10.5.7. I used this command to configure GCC after installing GMP, MPFR, and MPC: ../gcc-4.5.0/configure --target=$i586-elf --prefix=/usr/local/cross \ --disable-nls \ --enable-languages=c,c++,fortran,java,objc,obj-c++,treelang,ada \ --without-headers --with-libiconv-prefix=/opt/loc...

g++ linking issues: undefined reference to functions

I used CMake and Visual C++ to build the HyDE library. Then, still in VC++, I was able to successfully create code and build an executable that links into HyDE.lib and the HyDE header files. I then discovered that in order to work with others at my company, it would be preferable to develop in Eclipse CDT. Knowing very little about Ec...

How do I make a makefile rule execute its prerequisites?

I have a makefile containing rules to build the system, tests, and run them. The last item is executed by just calling a shell script. Among other things, this prevents me from running the tests in parallel. I have the following variables: TEST_SRC=$(wildcard tests/*.c) TESTS=$(patsubst %.c,%,${TEST_SRC}) and it builds the tests with...

Makefile with multiple targets

Hopefully this is a very simple question. I have a makefile pattern rule that looks like this: %.so : %.f %.pyf f2py -c -L${LAPACK_DIR} ${GRASPLIBS} -m $* $^ ${SOURCES} --opt='-02' --f77flags='-fcray-pointer' >> silent.txt I want the makefile to build a number of .so files, so I tried to get it to build two files (radgrd_py.so and...

Makefile: install target usable from the CLI or a packaging system ?

Hi, given this simple install target for my Makefile: install: zrm $(CONF) install -D -m 0755 -o mysql -g mysql conf/lvm0.conf $(DESTDIR)/$(CONFDIR)/lvm0/mysql-zrm.conf install -D -m 0755 -o mysql -g mysql conf/inc1.conf $(DESTDIR)/$(CONFDIR)/inc1/mysql-zrm.conf install -D -m 0755 -o mysql -g mysql conf/dump0.co...

how to make $(eval $(shell ...)) work in GNU make

make syntax is newline-delimited, but $(shell ...) replaces newlines with whitespace. So what's the least ugly way to do $(eval $(shell program-that-emits-makefile-fragment)) which doesn't work the way one might like. ...