makefile

How can I affect PATH in a makefile variable? Why is my example not working?

At the beginning of a makefile I have this line : PATH := $(PATH):/other/dir and this gives this error: Recursive variable 'PATH' references itself. What do I have to do so it works? ...

How should a very simple Makefile look like for Cuda compiling under linux

Hi, I want to compile a very basic hello world level Cuda program under Linux. I have three files: the kernel: helloWorld.cu main method: helloWorld.cpp common header: helloWorld.h Could you write me a simple Makefile to compile this with nvcc and g++? Thanks, Gabor ...

Pre-build step in makefile

Hi! How can I run a script, which must execute before all other makefile commands? And it will be nice (but not mandatory) to the script is not executed if there is nothing to build. I've searched SO and Google, but can't find anything. I have this workaround: # myscript.bat output is empty CHEAT_ARGUMENT = (shell myscript.bat) CFLAG...

How to do a Makefile using a specific libraries in different paths?

Hi, The issue I'm having is that I need to compile my code using specific libraries that are in different path locations. I need to use -lncurses library from ./ramdisk/libs path, the problem is that this directory also cointains a version of lthr library that I don't want to be linked. The makefile is pulling both libraries from the s...

Multicore make in parallel rather than "threaded" execution?

I have a Makefile to execute a test suite that looks roughly like this: %.diff.png: %.test.png echo '$*: Comparing with good PNG.' %.test.png: %.pdf echo '$*: Converting PDF to PNG.' %.pdf: %.tex echo '$*: Generating PDF output.' with all the echo statements supplemented with the actual tests in the real Makefile. When...

Wildcard targets in a Makefile

How can I compact the folllowing Makefile targets? $(GRAPHDIR)/Complex.png: $(GRAPHDIR)/Complex.dot dot $(GRAPHDIR)/Complex.dot -Tpng -o $(GRAPHDIR)/Complex.png $(GRAPHDIR)/Simple.png: $(GRAPHDIR)/Simple.dot dot $(GRAPHDIR)/Simple.dot -Tpng -o $(GRAPHDIR)/Simple.png $(GRAPHDIR)/IFileReader.png: $(GRAPHDIR)/IFileReader....

How do I pause to inspect results of sh commands run by a Makefile?

So, I have a Makefile which runs different commands of how to build S/W. I execute make from within a MSYS / MinGW enviroment. I found for example, the sleep <seconds> command, but this only delays the execution. How can I make it wait for a key being pressed, for example? ...

running grep from within GNU make

I need to find the text 'ifeq ($(Param1)' using grep. I try to assign search result to make variable. The problem is that single quotes don't escape text in make so when I try: GrepResult:= $(shell grep 'ifeq ($$(Param1)' TextFile) I get: Makefile:214: *** unterminated call to function `shell': missing `)'. Stop. The $ can be esca...

Override target in makefile to add more commands?

At work we use a common makefile that other makefiles include (via the include statement) and it has a generic "clean" target that kills some common files. I want to add on to that target in my new makefile so I can delete some specific files, but if I add a clean target in my makefile, it just overrides the old one. I know I can just ...

In what order prerequisites will be made by the GNU make?

Assuming we have the rule: a: b c d e and b, c, d and e are independent of each other. Is the order of making b, c, d, e defined? It seems that generally they will be made in order b, c, d, e, but may it sometimes happen, that the order will be different? ...

Windows Makefile and Setting Environment Variable

My Product is built using cygwin on Windows. but Windows Tools does not understand cygwin path like /home/lib/ How do I set those variables during runtime , like can I set environment variable set LIB_PATH=`cygpath -w /home/lib' Something like this. ...

makefile missing separator

Hi guys... I have a makefile (provided by third party) which gives the following error Makefile:108: *** missing separator. Stop. The line in question is the following if statement.... any ideas? have tried various replacing tabs with spaces and not got very far at all... if have_sdl libiulib_a_SOURCES += $(srcdir)/utils/...

Invoking makefile in the project root directory from subdirectory Emacs - C++

I have a makefile in the project root directory. If I am editing a file in a subdirectory, how do I invoke make from EMACS? M-x compile make will not work as it looks for the makefile in the current directory. But I have the makefile in the project root directory. Any thoughts? Edit As suggested, *make -f fullpath_to_makefile* did th...

Parallelization of recursive jobs in GNU make

Hi, I am looking for an elegant way for the parallelization of jobs in GNU make. Here is a sample of what I did so far. Make processes the directories dir-1, dir-2 and dir-3 in a serial fashion which is logical but not my intention: SUBDIRS=dir-1 dir-2 dir-3 default: all all: @for dir in $(SUBDIRS); do (cd $$dir; $(MAKE)); done .P...

Using make to generate bison grammar

In a project that uses make and bison, I'm having difficulty specifying that the compiled grammar grammar.tab.c depends on the grammar input grammar.y, that each object file depends on a corresponding source file (including grammar.tab.o), and that the executable depends on all object files. The problem is that running make when grammar...

How to make dependency in makefile so that target is built when bazaar revision changes?

I have a script that is designed to generate a config.h in the source tree, to be used by the code at compile-time. Information included in this includes the bazaar revision number. My project is based only on a Makefile. I would like to add config.h as a target to be built when the script to make config.h is changed or the bazaar revis...

No rule to make target ... libm.a

I get the following error when I try to compile my app: *** No rule to make target `/mypath/lib/libm.a', needed by `/myPath/bin/appName' Why is the linker looking for libm.a according to an absolute path? ...

Can 'make' check if mtime of a dependency is *different* between runs, not just if it's newer than target?

If foo_user.cpp depends on foo.h, then foo_user.cpp is built, and then foo.h's modification time is set to further in the past, make will not rebuild foo_user.cpp (because foo.cpp is 'newer'). I'd prefer it if make recorded the modification times of dependencies, and if they changed at all (newer or older), to consider targets of that de...

compiler directive for compiling on different platforms

Hello, I am compiling a demo project. The project is written for windows and linux. I have written a Makefile. However, I am not sure how to specify the platform the compiler will be compiling on. I will be compiling on Linux. In my source file I have this: #if defined(WIN32) #include ... #include ... #elif defined(LINUX) #include ....

Determine RC dependencies

I have a fairly large project which uses make for its build infrastructure. When we perform a build, we take advantage of cl.exe's /showInclude option to find source dependencies. Is there a similar capability for rc.exe? The basic problem is this: A makefile specifies a resource to be compiled (say, resources.rc). The resource file...