makefile

Makefile - change variable value depending on a target.

I am not proficient with makefiles, but am used to simple ones. Right now, I have a task on hand. I need to compile and link a test application with a different library and different include path based on the given target. If target is TARGET1, then link against LIB1 and include INCLUDEPATH1 during compilation. Similarly, if given targe...

Makefile dependency generation not checking headers.

I'm using a makefile intending to generate dependencies automatically. But with my file, I find that although changes to the header files cause the code to be recompiled, they don't cause the dependencies to be regenerated, as I think they ought. Can anyone see what I have missed out? .SUFFIXES : .hpp .cpp .d .o SOURCES=main.cpp sub1.cp...

makefile execute another target

I have a makefile structured something like this: all : compile executable clean : rm -f *.o $(EXEC) I realized that I was consistently running "make clean" followed by "clear" in my terminal before running "make all". I like to have a clean terminal before I try and sift through nasty C++ compilation errors. So I tried to a...

Create make with Qt4 and MySQL driver plugin

Installing QT plain is no problem, but when you've got to recompile QT with a MySQL driver plugin? Confusing. And when I do run configure, Qt registers my MySQL driver, but when I attempt to run mingw32-make, this abomination shows up on my command prompt: g++.exe: ....corelibcodecsqisciicodec.cpp: No such file or directory g++.exe: n...

Makefile, modify list

If I have a list in a GNU Makefile, is it possible to create a new list with the original strings modified. This is would be perfect if there was the map higher-order procedure from some languages. This is an example of what I'm trying to do DIRS=A B C D #apply some magic to create DIRS_INCLUDE=-IA -IB -IC -ID ...

How to make a Makefile shorter?

Hi there, I've got the following Makefile: all: hello.exe hellogtk.exe hellogtktng.cs hello.exe: hello.cs gmcs hello.cs hellogtk.exe: hellogtk.cs gmcs -pkg:gtk-sharp-2.0 hellogtk.cs hellogtktng.exe: hellogtktng.cs gmcs -pkg:gtk-sharp-2.0 hellogtktng.cs clean: rm -f *.exe I'm only starting to learn how to write Makefiles, and ...

Can a makefile have a directory as a target?

I am trying to say "the download of the git repository will only work if the directory yank/ exists. If the directory yank/ does not exist then make it" yank/gist.el/gist.el : yank cd yank ; git clone http://github.com/defunkt/gist.el.git yank: mkdir yank I am using makepp - http://makepp.sf.net and am getting the error: [m...

what, besides the source, would cause an explicit rule to execute to produce a makefile target?

It is clear that the target is newer than the source from these two ls comands: [metaperl@andLinux ~/edan/pkg/gist.el] ls -l ../../wares/gist.el/gist.elc #target -rw-r--r-- 1 metaperl metaperl 10465 Jul 18 10:56 ../../wares/gist.el/gist.elc [metaperl@andLinux ~/edan/pkg/gist.el] ls -l yank/gist.el/gist.el #source -rw-r--r-- 1 metaperl m...

Is there any equivalence of __DIR__ in Makefile?

In many script files, _DIR_ means the directory where the script file itself is located. Is there any equivalence in GNU Make? ...

How to write a makefile for a C++ project which uses Eigen, the C++ template library for linear algebra?

Hi Guys, I'm making use of Eigen library which promises vectorization of matrix operations. I don't know how to use the files given in Eigen and write a makefile. The source files which make use of Eigen include files as listed below, these are not even header files (They are just some text files)- <Eigen/Core> <Eigen/Dense> <Eigen/Eige...

Why is my .cpp file not being processed?

I'm trying to compile (make) a game source and it seems that my gRace.cpp file is being excluded or something because it keeps returning undefined reference errors for all my gRace class methods. libtron.a(libtron_a-gGame.o): In function `gGame::StateUpdate()': gGame.cpp:(.text+0x99e9): undefined reference to `gRace::Reset()' libtron.a(...

Does CMake has something like % substitution support from Make?

I need a chain of file processing in my build-process. Workflow can be easily specified and built around a filename, only extension changes, like file.a -> file.b -> file.c. So, it's clearly a case for Make's declarative syntax. But as I see, for CMake this will look like an explicit *add_custom_command* for each file for each step of pr...

Executing commands in the directory in which the file that they were defined in is located

Consider, if you will, the following situation: $ pwd /tmp/submake_example $ head $(find -type f) ==> ./subdir/Makefile <== subtarget: echo "executing subtarget from directory $$(pwd)" ==> ./Makefile <== include subdir/Makefile $ make subtarget echo "executing subtarget from directory $(pwd)" executing subtarget from directory ...

why is a dot in front of include in the freebsd ports makefile? what make do they use?

I was looking through the main makefile in the ports tarball of FreeBSD. I saw the following include directive: PORTSTOP= yes .include <bsd.port.subdir.mk> index: @rm -f ${INDEXDIR}/${INDEXFILE} @cd ${.CURDIR} && make ${INDEXDIR}/${INDEXFILE} and was wondering why a period was in front of include. Also, are they using GN...

How can you force recompilation of a single file in a Makefile?

The idea is that a project has a single file with __DATE__ and __TIME__ in it. It might be cool to have it recompiled without explicitly changing its modification date. edit: $(shell touch -c ..) might be a good solution if only clumsy. ...

Problem using SDCC in a Makefile during the link step

The Small Device C Compiler (SDCC) will produce a ihx (Intel Hex) file even if there are undefined reference errors during the link step. This behavior causes problems when using SDCC in a Makefile because if you set the ihx file to be your make target, then make has no good way of knowing that a previous attempt at linking has failed. ...

makefile : missing separator

#kernel build system and can use its lanauge ifneq($(KERNELRELEASE),) obj-m:=helloworld.o else KDIR:= /lib/modules/2.6.33.3-85.fc13.i686/build all: make -C $(KDIR) M=$(PWD) modules clean: rm -f *.ko *.o *.mod.o *.mod.c *.symvers endif The error is: makefile:2:* missing separator . stop but for the ifneq($(KERNELRELEASE),), if...

Detect Java location from Makefile

Hello, I have a makefile, which needs to know the location of the Java include directory because it makes use of the jni.h file. What is the best way of allowing the Makefile to auto-detect where Java is installed on Linux? Thanks, Chris ...

make install only if file changed

When writing a well crafted Makefile, one that keeps proper dependencies, and do only the minimum needed if a file has been changed, it seem that the install: target is often overlooked. More often then not the install target looks something like: TRG := /trg BIN_TRG := $(TRG)/bin ETC_TRG := $(TRG)/etc BIN_FILES := b1 b2 b3 ETC_FILES :=...

make deleting dependency files

I'm not sure if it's gmake or gcc that I don't understand here. I'm using the -MM and -MD options to generate dependency rules for the Unit Testing framework I'm using. Specifically: $(TEST_OBJ_DIR)/%.d: $(TEST_SRC_DIR)/%.cpp @$(CPPC) -MM -MD $< -o $@ @sed -i -e 's|\(.*\)\.o:|$(OBJ_DIR)/\1.o $(TEST_OBJ_DIR)/\1.d $(TEST_OBJ_DIR)/\1...