Compiling with g++ using multiple cores
Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? 8 Answers 8
Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)? 8 Answers 8
I’m connected to my university’s small Linux cluster via PuTTY and WinSCP, transferring files using the latter and compiling and running them with the former. My work so far has been performed in the university’s labs, but today I have been doing some work at home that generated an interesting warning. I uploaded an entire … Read more
How could I abort a make/makefile execution based on a makefile’s variable not being set/valued? I came up with this, but works only if caller doesn’t explicitly run a target (i.e. runs make only). ifeq ($(MY_FLAG),) abort: ## This MUST be the first target 🙁 ugly @echo Variable MY_FLAG not set && false endif all: … Read more
I would like to change this Makefile: SHELL := /bin/bash PATH := node_modules/.bin:$(PATH) boot: @supervisor \ –harmony \ –watch etc,lib \ –extensions js,json \ –no-restart-on error \ lib test: NODE_ENV=test mocha \ –harmony \ –reporter spec \ test clean: @rm -rf node_modules .PHONY: test clean to: SHELL := /bin/bash PATH := node_modules/.bin:$(PATH) boot: @supervisor \ … Read more
I want to run ‘make install’ so I have everything I need, but I’d like it to install the things in their own folder as opposed to the system’s /usr/bin etc. is that possible? even if it references tools in the /usr/bin etc.? 7 Answers 7
What does the following do in a Makefile? rule: $(deps) @: I can’t seem to find this in the make manual. 2 Answers 2
I have the following makefile for my project, and I’d like to configure it for release and debug builds. In my code, I have lots of #ifdef DEBUG macros in place, so it’s simply a matter of setting this macro and adding the -g3 -gdwarf2 flags to the compilers. How can I do this? $(CC) … Read more
I’ve just inherited some C++ code that was written poorly with one cpp file which contained the main and a bunch of other functions. There are also .h files that contain classes and their function definitions. Until now the program was compiled using the command g++ main.cpp. Now that I’ve separated the classes to .h … Read more
In the GNU Makefile manual, it mentions these prefixes. If .ONESHELL is provided, then only the first line of the recipe will be checked for the special prefix characters (‘@’, ‘-’, and ‘+’). What do these prefixes do, and where are they mentioned? 2 Answers 2
I wrote a program for an assignment which is supposed to print its output to stdout. The assignment spec requires the creation of a Makefile which when invoked as make run > outputFile should run the program and write the output to a file, which has a SHA1 fingerprint identical to the one given in … Read more