gnu-make

GNU Make --output-sync doesn't work?

百般思念 提交于 2019-12-06 02:09:41
问题 this is driving me bonkers. For parallel make builds (-j), you're supposed to be able to synchronize the console output. Here is ref: GNU Make Manual: 5.4.1 Output During Parallel Execution I'm using GNU Make 3.82 for x86_64-redhat-linux-gnu Un-Synchronized: make -j8 all //not synchronized yields (i'm using eclipse-cdt managedbuild here): Building file: ../dome.c Building file: ../main.c Invoking: GCC C Compiler gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"dome.d" -MT"dome.d" -o "dome

Unreliable parallel builds in a makefile with .INTERMEDIATE?

元气小坏坏 提交于 2019-12-06 01:38:41
I have a tool which generates multiple output files, which is notoriously hard to model in make. I'm using the recipe at GNU Makefile rule generating a few targets from a single source file , which seems simple and reliable. And it almost works. Unfortunately, I'm seeing some very odd behaviour with regard to parallel builds, where it seems to be dropping dependencies sometimes; and I don't understand why. Here's my test case: out3: out1 out2 touch out3 .INTERMEDIATE: out.intermediate out1 out2: out.intermediate out.intermediate: in touch out1 out2 If I build it once, it works: $ touch in $

Backtrace for GNU make

倖福魔咒の 提交于 2019-12-06 00:48:57
问题 Is there any way to get GNU make to print a "backtrace" of the targets that led to the command being executed when it fails? I regularly deal with heavily obfuscated makefiles while resolving portability issues building software on a new system, and it seems like this should be an extremely simple thing for make to do that would greatly aid in debugging, but I can't find any way to request it. What I'd like to see is something like: gcc: error: ... make[2]: error: gcc ... make[2]: error

Include generated makefile without warning message

冷暖自知 提交于 2019-12-05 23:37:35
问题 For a project of mine I am automatically generating makefiles and including them, like this: all: @echo 'SUCCESS is $(SUCCESS)' clean: rm depend.mk depend.mk: @echo 'Creating $@' @echo 'SUCCESS := 1' > $@ .PHONY: all clean include depend.mk This works, but the include line generates a warning message: $ make Makefile:13: depend.mk: No such file or directory Creating depend.mk SUCCESS is 1 I would like to silence that first warning line saying that depend.mk doesn't exist. I know it doesn't

Makefile, Regex and multiple dependencies

﹥>﹥吖頭↗ 提交于 2019-12-05 21:56:39
Assume the following files are in the same directory as the makefile: 01.1.dot 01.2.dot 02.1.dot 03.1.dot 03.2.dot 03.3.dot That means we have files of the form [0-9][0-9].[0-9].dot Furthermore, the makefile contains the following target: %.dot.tex: %.dot dot2tex <...> Now I would like to create a target which depend on files of the form [0-9][0-9].tex and they should also depend on all files of the form [0-9][0-9].*.dot.tex, such that the first two digits match. For example, make 03.pdf should depend on 03.tex , 03.1.dot.tex , 03.2.dot.tex and 03.3.dot.tex . I came up with the following: %

When should a call to *eval* be evaluated in a make recipe

好久不见. 提交于 2019-12-05 21:55:56
I have a few software projects which are distributed as RPMs. They are versioned using semantic versioning to which we affix a release number . Using the regular conventions, this is MAJOR.MINOR.PATCH-REL_NUM . Though beyond the scope of this article, the release numbers are stored in git. The release target in the makefile looks something like this: release: make clean $(BLD_ROOT)/tools/incr_rel_num # Although the third step, this was re-ordered to step 1 $(eval RELEASE_NUMBER=$(shell cat $(BLD_ROOT)/path/to/rel_num.txt)) make rpm RPM_RELEASE_NUM=$(RELEASE_NUMBER) While debugging, I

How to generate multiple executable files in one Makefile?

∥☆過路亽.° 提交于 2019-12-05 21:30:28
My directory contains 2 source files: a.c and b.c . I want to generate executable file a from a.c and b from b.c . Now I can only figure out one method to write Makefile: all: gcc -o a a.c gcc -o b b.c It seems a little awkward, is it better method? The answers are fine, still I think you need some insight in how make works: The basic functionality of make is to create output files from input files if necessary . make decides what is necessary by comparing timestamps: If any input file is newer than an output file created from it, the recipe for this output file is executed. This means with

How can I make a target “private” in GNU make for internal use only? OR: how to best enforce target-specific variable-values?

ⅰ亾dé卋堺 提交于 2019-12-05 20:21:39
问题 I have some ancillary targets in a makefile that I want to restrict for internal or "private" use (only) inside the makefile. That is, I want to be able to specify these targets as dependencies from within the makefile, but I want to prevent the target from being specified as a build goal from the command line. Somewhat analogous to a private function from OOP: the target is harmful (or simply doesn't make sense) to build separately. I wish there were a special-target .HIDDEN or .PRIVATE or

Makefile pattern rule fails?

大兔子大兔子 提交于 2019-12-05 19:49:26
问题 While using GNU-make, my Makefile has some pattern rule as: %.o:%.c gcc $< -o:$@ This rule is added by me. But when I do make it gives an error saying No rule to make target %.o and doesn't build the targets. At times, there is this other behaviour as well. It does not build the target when I say make first time(It gives error saying No rule to make target), but when i say make again immediately, it does build correctly. So when i explicity specify each source file separately, then it builds

No rule to make target `/Makefile', needed by `Makefile'

不想你离开。 提交于 2019-12-05 17:20:24
I'm trying to 'make' using a pretty simple makefile. My makefile is named 'Makefile' so I'm simply using the command 'make'. I get this strange error: make: *** No rule to make target `/Makefile', needed by `Makefile'. Stop. If, however, I use make -f "full-path-to-makefile" it actually does run (with odd consequences...). I should say that I'm running all this from the directory where the Makefile lies, of course. I'm working on Mac OSX, using tcsh. Edit: I'm working in the LLVM framework, trying to compile a pass function and this is the associated makefile: LEVEL = ../../../ LIBRARYNAME =