make

How do I use dependencies in a makefile without calling a target?

I'm using makefiles to convert an internal file format to an XML file which is sent to other colleagues. They would make changes to the XML file and send it back to us (Don't ask, this needs to be this way ;)). I'd like to use my makefile to update the internal files when this XML changes. So I have these rules: %.internal: $(DATAFILES...

Make failure in subdirectory make not stopping build

I have a setup where make is going through a bunch of subdirectories and making inside those directories. I would like it to stop the build on a failure immediately. The code snippet below illustrates this. Can someone point me in the right direction on how the makefile should be set up or some documentation about building from a top ...

How can i print the compilation options on making several C files using GCC and make

I want to print my whole file compilation options on make in my console on build. For example on compiling test1.c test2.c test3.c using make should print like cc -g -O1 -Wall test1.c cc -g -O1 -Wall test2.c cc -g -O1 -Wall test3.c ...

How to make SIMPLE C++ Makefile?

Hi everyone, For a project, we are required to use a makefile to pull everything together, but our abhorrent professor never showed us how to. I only have ONE file, a3driver.cpp. The driver imports a class from a location "/user/cse232/Examples/example32.sequence.cpp". That's it, everything else is contained with the .cpp. How would ...

makefile: execute one target from another target plus additional commands

I have a makefile with something like the following targets: install: do a whole bunch of stuff to install dist: install cp README.txt $(INSTALL_DIR) zip $(INSTALL_DIR) I am trying to not repeat the commands from target install and make dist execute install first before executing its own commands. Calling make dist does...

Recursive wildcards in GNU make?

It's been a while since I've used make, so bear with me... I've got a directory, flac, containing .FLAC files. I've got a corresponding directory, mp3 containing MP3 files. If a FLAC file is newer than the corresponding MP3 file (or the corresponding MP3 file doesn't exist), then I want to run a bunch of commands to convert the FLAC fil...

Tips on how to deploy C++ code to work every where

I'm not talking about making portable code. This is more a question of distribution. I have a medium-sized project. It has several dependencies on common libraries (eg openssl, zlib, etc). It compiles fine on my machine and now it's time to give it to the world. Essentially build engineering at its finest. I want to make installers...

Yacc and Lex inclusion confusion

I am wondering how to correctly compile a program with a Makefile that has calls to yyparse in it? This is what I do: I have a Makefile that compiles all my regular files and they have no connections to y.tab.c or lex.yy.c (Am I supposed to have them?) I do this on top of my code: #include "y.tab.c" #include "lex.yy.c" #include "y.ta...

GNU make: should -j equal number the number of CPU cores in a system?

Hi What is you experience with the make -j flag? There seem to be some controversial if the jobs are supposed to be equal to the numbers of cores, or if you can maximize the build by adding one extra job that can be cued up while the others "work". The question is if it is better to use -j4 or -j5 on a quad core system? And have you...

Preventing objects from being linked if they are not needed?

I have an ARM project that I'm building with make. I'm creating the list of object files to link based on the names of all of the .c and .cpp files in my source directory. However, I would like to exclude objects from being linked if they are never used. Will the linker exclude these objects from the .elf file automatically even if I inc...

How to fix this Makefile

I want my Makefile to be as simple as possible and still function. This is what it looks like. load: load.cpp g++ load.cpp -g -o load list: list.cpp g++ list.cpp -g -o list It worked fine when there was only one entry. But when I added the second entry, it doesn't check to see if it's updated and needs to be recompiled, unle...

Makefile - What does "all" stand for?

I read some tutorials concerning Makefiles but for me it is still unclear for what the target "all" stands for and what it does! Any ideas? ...

What is the best approach to use different CFLAGS for the same source files?

Hello, i need to build the same source tree twice, 1 - with normal cflags to build the project binary 2 - with cflags plus -fPIC to build a static library that would be some sort of SDK to develop project dynamic modules. Using only one Makefile, what is the best approach to accomplish this? It would be nice to do some sort of : al...

Is everything to be explicit for makefile of c++?

I mean,does makefile search some default directories that is not specified explicitly? ...

Does "make install", by convention, updates the targets it installs?

You usually invoke the following commands to build a ./configured product: make make install Okay, the product is in the system now. Then you change some source code files and invoke only make install. The question is, does the conventional implementation of install target requires the executables to be recompiled, or just the old o...

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

Not sure if this is possible in one Makefile alone, but I was hoping to write a Makefile in a way such that trying to build any target in the file auto-magically detects the number of processors on the current system and builds the target in parallel for the number of processors. Something like the below "pseudo-code" examples, but much...

makefile from Linux doesn't work in OpenSolaris

In OpenSolaris OS, when I run makefile generated by Eclipse CDT on the Linux OS, I get an error on the first -include line. The same error was in FreeBSD, and was solved by executing gmake instead of make. In OpenSolaris (just installed) gmake doesn't work (command not found). What package should I install and how exactly, to build L...

What does a typical ./configure do in linux?

Why is it necessary though everything is specified in a makefile? ...

When will implicit rule be applied for a makefile?

It says: In general,make searches for an implicit rule for each target[1], and for each double-colon rule[2], that has no commands[3]. This can have two different understanding: 1 or (2 and 3) (1 or 2) and 3 Which does it mean? ...

Cross Platform build

I have an application in which we use a hand-made build system.The reason for this is portability: the application should be portable on Linux/Mac/Windows. There are some port-specific files that are not updated by the default build system. What I do now is update the files manually or have a script do this. However, I am thinking of s...