makefile

Debugging a makefile step by step

I want to debug a makefile . I came across many posts in Stackoverflow but still need some help . INCLUDEPATHS=/I"/C:/wxWidgetsDev/lib/vc_lib/mswd" /I"/C:/wxWidgetsDev/include/msvc/" LIBPATHS=LIBPATH:"/C:/wxWidgetsDev/lib/vc_lib" HEADERS=headers.h util.h main.h serialize.h uint256.h db.h base58.h I am using Visual Studio 2008. The IN...

Makefile calling other makefile with target, gives wrong target

I have a makefile with a target clean: clean: $(MAKE) -f <other makefile location> clean When I call make clean in this makefile, it tells me that in the other makefile there is no rule 'clean-linux'. Specifically here is the output. make -f /root/ovaldi-5.5.25-src/project/linux/Makefile clean make[1]: Entering directory '/root/o...

Makefile for program running on different machines

Hi, I have a C++ program that will run on several machines that use a Network File System. For each of the C++ libraries that my program uses, I installed a version for each machine, under ~/program_files/machinename/libraryname. "machinename" is obtained via bash command "hostname". On the machines I am using, "hostname" outputs someth...

How to generate complex Makefiles, e.g. from a template

Makefiles are really really useful. But, the syntax is somewhat complex and limited. For a project, I need to create targets 1 to n, and would really like to write something like this: all : target1 ... target100 target%d : target%d.pre ./script.py %d I would like to have make capture the variable (%d) and then use it throughout ...

Including boost libraries in make files.

I'm learning Boost and am having trouble with my makes files. Here is my basic makefile: accesstimer: acctime.o btimer.o g++ acctime.o btimer.o -o accesstimer acctime.o: acctime.cpp btimer.h g++ -c acctime.cpp bentimer.o: btimer.cpp btimer.h g++ -c btimer.cpp When acctime.cpp has no boost filesystem elements in it this...

How to compile different c files with different CFLAGS using Makefile?

Hi, all. Let's say I have a program that contains a long list of C source files, A.c, B.c, ...., Z.c, now I want to compile A.c, B.c with certain CFLAGS, and compile the rest part of source files with a different CFLAGS value. How to write a Makefile to do the above described job? currently what I am doing in my Makefile is: OBJ=[all ...

cannot link boost.system in makefile

Just asked a question about linking Boost libraries in the make file. Thanks to those who helped with that. I ended up with this: accesstimer: acctime.o bentimer.o g++ -L/usr/local/boost/boost_1_39_0/stage/lib -lboost_system -lboost_filesystem acctime.o bentimer.o -o accesstimer acctime.o: acctime.cpp bentimer.h g++ -I /us...

how to use my own dynamic library in linux (Makefile)

Hi, all, I have a c++ project (g++/raw Makefile) designed for linux, I used to statically link everything which worked fine for ages. Now I want to build binaries both statically and dynamically linked. The following command is used in my Makefile to build the dynamic library (say libtest): $(CXX) -shared -Wl,-soname,libtest.so.1 -o l...

Is optimization and generating debug info part of compilation or linkage

I am reading a Makefile from someone else as follows. LDFLAGS=-lm -ljpeg -lpng ifeq ($(DEBUG),yes) OPTIMIZE_FLAG = -ggdb3 -DDEBUG -fno-omit-frame-pointer else OPTIMIZE_FLAG = -ggdb3 -O3 endif CXXFLAGS = -Wall $(OPTIMIZE_FLAG) all: test test: test.o source1.o source2.o $(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) M...

Error seen while trying to compile live555 video streaming platform code in Visual Studio 9.0

Dear Mr. Butterworth, I am trying to compile the video streaming live 555 platform code on my system using Microsoft Visual Studio 9.0. The code is available in this link: http://www.live555.com/liveMedia/public/ I have generated the makefiles for this code using the provided genWindowsMakefiles script provided here. The problem I enco...

Makefile in top level directory and sources in the subdirectories problem

I have a directory called "project". It contains two sub-directories called "client" and "server" and a makefile called "Makefile". client and server have got source files called "client.c" and "server.c" respectively. I dont have any separate makefiles in the subdirectories for sources belonging to that directory. All making is done by ...

Four Dollar signs in Makefile

Hi, I am reading the document of GNU Make. Here is an example %.d: %.c @set -e; rm -f $@; \ $(CC) -M $(CPPFLAGS) $< > $@.$$$$; \ sed ’s,\($*\)\.o[ :]*,\1.o $@ : ,g’ < $@.$$$$ > $@; \ rm -f $@.$$$$ I tried this on a C++ program, and got the list of files init3d.d init3d.d.18449 input.d input.d.18444 m...

automate rules in makefile from two variables at the same time

I have some search patterns that fits poorly as part of a file name for the result. I therefore split the regular expression and the corresponding file name part into two different variables like below. How can I automate the following so that I do not have to manually list files for ALL and also do not have to manually enter the rules r...

get ouput from shell script back into a makefile

I've tried something like this: VAR := $(echo \`find . -name ".txt"`) but when I echo $VAR from inside a target, I get nothing... ...

makefile: how to add a prefix to the basename ?

Hi all, I have a list of file path like that: FILE_PATH := a1.so a2.so bla/a3.so bla/a3.so bla/blo/a4.so.... I need to add a prefix to the basename in order to get: FILE_PATH_PREFIX := liba1.so liba2.so bla/liba3.so bla/liba3.so bla/blo/liba4.so.... any idea ? Cheers dave ...

Makefile can`t understand comments

If I put comments (# ...) in my Makefile, make gives me an error and quit. If I remove the comments, the makefile works fine. Makefile:1: *** missing separator. Stop. Make-version: 3.81 Linux: Ubuntu 9.04 The Makefile: # Backup Makefile # # Create backups from various services and the system itself. This # script is used to perfor...

Conditional sections in AIX Makefiles

How do I make a makefile that works on AIX, Linux and SunOS and has the ability to provide different compiler options for each environment? I have access to an environment variable which describes the OS, but the AIX make utility does not like ifeq, so I can't do something like: ifeq($(OS), AIX) CFLAGS = $(CFLAGS) <IBM compiler opt...

Can we include another Makefile in a GNU Makefile by using the relative path?

I have a Makefile in: project/all_app/myapp/src/Makefile I also have a master Depend.mk in project/Depend.mk Can I include the main Makefile by using the relative path? include ../../../../Depend.mk ...

Target-specific Variables as Prerequisites in a Makefile

I'm trying to write a GNU make Makefile which has a load of similar targets, where the build commands vary slightly between them. I'm trying to use target-specific variables to represent these variations. Some of these variable values refer to files I want to use as prerequisites. For example: target_1:special_filename=target1_prereq ta...

optimization and debugging options in Makefile

I wonder where to put the optimization and debugging options in Makefile: linking stage or compiling stage? I am reading a Makefile: ifeq ($(STATIC),yes) LDFLAGS=-static -lm -ljpeg -lpng -lz else LDFLAGS=-lm -ljpeg -lpng endif ifeq ($(DEBUG),yes) OPTIMIZE_FLAG = -ggdb3 -DDEBUG else OPTIMIZE_FLAG = -ggdb3 -O3 endif ifeq ($(PROF...