makefile

Adding custom code to a Makefile generated by Automake

Suppose I want to add a runtime conditional to a Makefile generated by Automake. Is there any way to tell Automake about this conditional? ...

My makefile builds dependency files when not required - why?

I'm trying to create a generic makefile to build static libraries that my project uses. I've used the expertise on this site, as well as the GNU Make manual to help write the following makefile. It is working well apart from one annoying problem. # Generic makefile to build/install a static library (zlib example) ARCH = linux CFLAG...

Error building GLib

Im trying to build GLib-2.4.0 using the makefile. I get this error: gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -pthreads -g -O2 -Wall -MT gatomic.lo -MD -MP -MF .deps/gatomic.Tpo -c gatomic.c -fno-common -DPIC -o .libs/gatomic.o /var/tmp//cctTs...

compiling using a Makefile

Hello, gcc 4.4.4 I have the following Makefile OBJECT_FILES = brd.o logger.o test_brd.o CFLAGS = -m32 -ggdb -Wall -Wextra -D_REENTRANT -D_THREAD_SAFE -O0 -D_DEBUG # Linker Run-time library path LDFLAGS = -Wl,-rpath=/usr/NET/lib FLATFORM = -DLINUX TARGET = dlg CC = gcc -m32 LIBS_PATH = -L/usr/NET/lib INC_PATH = -I/usr/NET/include ...

makefile option to generate latex documentation

I have a project that can be built via makefile, and I would like to add the ability for someone in the base directory to not only be able to build the executable via make, but also to build the documentation pdfs from LaTeX in a separate directory by typing make docs or something similar. I only need one pass to generate the documentati...

Syncing Eclipse makefiles and working sets

We are developing a project that has a fair amount of shared 'library' code, and application code specific for each product. We have makefiles for each product, and we have started to set up working sets that show only the files that are pulled in from the common lib code, but doing this by hand is slow and repetitive, and could be hard ...

Generic (non-file) pattern matching in Makefile

Is it possible to have wildcard targets for non-filenames, like: build-%: pull-% build-%.stamp pull-%: cd $* ; git log HEAD..origin/master | grep -q . && ( git pull ; $(RM) ../build-$*.stamp ) || true build-%.stamp: cd $* ; ant touch $@ The idea is to call make build-foo, which will only call the build when there are new upstrea...

Enable Exception C++

Hi. I am trying to make APP native code for Android. The Native code is in cplusplus. Whenever I try to make, the following error appears. H236Plus.cpp:135: error: exception handling disabled, use -fexceptions to enable How do I use -fexceptions to enable exception handling, and where do i use it? ...

What do the makefile symbols $@ and $< mean?

CC=g++ CFLAGS=-c -Wall LDFLAGS= SOURCES=main.cpp hello.cpp factorial.cpp OBJECTS=$(SOURCES:.cpp=.o) EXECUTABLE=hello all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ .cpp.o: $(CC) $(CFLAGS) $< -o $@ What do the $@ and $< do exactly? ...

how to place .o files into a separate directory, with Makefile rule

I have the following Makefile rules: DIR = src SOURCES = $(shell find $(DIR) -name "*.cpp") OBJS := $(SOURCES:.cpp=.o) With this definition all my .o files are located in the same directories (and sub-directories) as their .cpp counterparts. Such allocation principle turns the project directory into a mess very soon (with 50+ files). ...

Conditional inclusion of object file in makefile on Eclipse/CDT

Hello, I am working on a project using Eclipse/CDT on Win-XP using non-managed make. The project has different variants which are created by changing some preprocessor directives (_DEBUG_, _PROD_). The problem is that for _DEBUG_, we use object files in the makefile that needs to be turned off for _PROD_. Right now, we have two entry p...

GNU Make: How to export the SHELL variable to sub-makes?

From the GNU Make manual: The value of the make variable SHELL is not exported. Instead, the value of the SHELL variable from the invoking environment is passed to the sub-make. You can force make to export its value for SHELL by using the export directive, described below. I must be doing something wrong, or not readin...

Portable makefile creation of directories

I'm looking to save myself some effort further down the line by making a fairly generic makefile that will put together relatively simple C++ projects for me with minimal modifications required to the makefile. So far I've got it so it will use all .cpp files in the same directory and specified child directories, place all these within ...

Make install causes recompiles

I am writing a master makefile to compile and install multiple autoconf based libraries, which depend on each other. All works well for the first go. The issue is: if I am working on one of these libraries individually and do "make && make install" header files in the prefix folder are overwritten (even if they are untouched). This cause...

Force gnu make to rebuild objects affected by compiler definition

I have a makefile that takes options at the command line make OPTION_1=1 Based on the value it will add additional compiler definitions to a subset of objects. ifeq ($(OPTION_1), 1) CC_FLAGS += -DOPTION_1_ON endif The change in the definition affects the included header file content - a stub or an implementation is exposed to the ...

Find underlying compiler in configure

I have an application which is compiled using compiler wrappers such as h5fc/h5cc (the HDF5 compiler wrappers), or mpif90/mpicc (the MPI compiler wrappers). These are just wrappers, and it is possible using the -show argument to see the real underlying compiler, e.g. $ h5fc -show ifort -fPIC [...] -lz -lm $ mpif90 -show ifort [...] -lmp...

GCC Compiler Flags Don't Match ELF Flags

I chopped down my make file so I can compile a C++ program with very few, but some flags set to see if I can determine if they are working. The following is my make file section on C++ flags: # Common compiler flags CFLAGS = -mips1 -Wa,-non_shared \ -mno-abicalls \ -I. -I$(SESCSOURCEDIR)/src/libapp \ -I$(SESC...

Debugging a Makefile

Let me prefice this question with the comment that I know very little about Makefiles or make. There is a very large project that is automatically built nightly. It is built in both Debug and Release mode, Debug being used for utilities like Valgrind to provide code analysis. Somehow, some of the built libraries are losing the debug fla...

Cross-platform svn management (Makefiles & Visual Studio)

I'm working on a little game called freegemas, it's an open source version of the classic Bejeweled written in C++ and using gosu as the graphic API. I've been developing it under Ubuntu Linux as usual, but the other day I wanted to give it a try and I compiled it on Windows using Visual Studio 2005 (which I had never used before). The p...

How to exclude certain #include directives from C++ stream?

I have this C++ file (let's call it main.cpp): #include <string> #include "main.y.c" void f(const std::string& s) { yy_switch_to_buffer(yy_scan_string(s.c_str())); yyparse(); } The file depends on main.y.c, which has to be generated beforehand by means of bison util. In other words, I can't compile main.c file if I forget to run b...