How can I write a makefile to auto-detect and parallelize the build with GNU Make?

The detection part is going to be OS dependent. Here’s a fragment that will work on Linux and Mac OS X: NPROCS:=1 OS:=$(shell uname -s) ifeq($(OS),Linux) NPROCS:=$(shell grep -c ^processor /proc/cpuinfo) endif ifeq($(OS),Darwin) # Assume Mac OS X NPROCS:=$(shell system_profiler | awk ‘/Number Of CPUs/{print $4}{next;}’) endif To get it working you are probably going … Read more

rm -rf versus -rm -rf

It means that make itself will ignore any error code from rm. In a makefile, if any command fails then the make process itself discontinues processing. By prefixing your commands with -, you notify make that it should continue processing rules no matter the outcome of the command. For example, the makefile rule: clean: rm … Read more

How to get CMake to use existing Makefile?

Take a look at the ExternalProject module. This will add a dummy target to your CMake project that is responsible for building the dependency. The command is quite complex and supports a lot of stuff that you probably won’t need in your case. Kitware (the company behind CMake) did a nice post called Building External … Read more

Any difference between configure.ac and configure.in, and Makefile.am and Makefile.in?

configure.ac and configure.in are two possible names for the master Autoconf source file, which is processed by autoconf to generate the configure shell script. configure.ac is preferred for new packages, configure.in is an older name which still works. (The .in suffix is now recommended to be used only for files which will be processed by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)