Using G++ to compile multiple .cpp and .h files
list all the other cpp files after main.cpp. ie g++ main.cpp other.cpp etc.cpp and so on. Or you can compile them all individually. You then link all the resulting “.o” files together.
list all the other cpp files after main.cpp. ie g++ main.cpp other.cpp etc.cpp and so on. Or you can compile them all individually. You then link all the resulting “.o” files together.
You need to install Xcode from App Store. Then start Xcode, go to Xcode->Preferences->Downloads and install component named “Command Line Tools”. After that all the relevant tools will be placed in /usr/bin folder and you will be able to use it just as it was in 10.6.
They control the behaviour of make for the tagged command lines: @ suppresses the normal ‘echo’ of the command that is executed. – means ignore the exit status of the command that is executed (normally, a non-zero exit status would stop that part of the build). + means ‘execute this command under make -n‘ (or … Read more
The -B switch to make, whose long form is –always-make, tells make to disregard timestamps and make the specified targets. This may defeat the purpose of using make, but it may be what you need.
make -C /path/to/dir
By default, it begins by processing the first target that does not begin with a . aka the default goal; to do that, it may have to process other targets – specifically, ones the first target depends on. The GNU Make Manual covers all this stuff, and is a surprisingly easy and informative read.
From the GNU Make documentation, 5.3.2 Choosing the Shell ———————— The program used as the shell is taken from the variable `SHELL’. If this variable is not set in your makefile, the program `/bin/sh’ is used as the shell. So put SHELL := /bin/bash at the top of your makefile, and you should be good … Read more
The following will do it if, as I assume by your use of ./a.out, you’re on a UNIX-type platform. for number in 1 2 3 4 ; do \ ./a.out $$number ; \ done Test as follows: target: for number in 1 2 3 4 ; do \ echo $$number ; \ done produces: 1 … Read more
In your example, the TMP variable is set (and the temporary directory created) whenever the rules for out.tar are evaluated. In order to create the directory only when out.tar is actually fired, you need to move the directory creation down into the steps: out.tar : $(eval TMP := $(shell mktemp -d)) @echo hi $(TMP)/hi.txt tar … Read more
The shell function. You can use shell function: current_dir = $(shell pwd). Or shell in combination with notdir, if you need not absolute path: current_dir = $(notdir $(shell pwd)). Update. Given solution only works when you are running make from the Makefile’s current directory. As @Flimm noted: Note that this returns the current working directory, … Read more