Is there a configuration file for gnu make?

make config file
makefile config
./configure file
makefile in
run configure
configure ac_
configure && make && make install
gnu configure

I want to tell make that it shall always use -j4 option even if I didn't specify it vie command line. Normally i would do this in some configuration file (i.e. ~/.makerc).

Does such file exist for gnu make?

Have a read about the $(MAKEFLAGS) variable:

export MAKEFLAGS=j4

However this will likely interfere with recursive-make-based builds (not that sensible people are using recursive make anyway!), by interfering with GNU make's ability to communicate with its sub-makes.

So the more sensible approach is probably a wrapper script or an alias or shell function.

makefile - Is there a configuration file for gnu make?, Instead, it should include a file Makefile.in which contains the input used for editing. Once again, this is so that people won't be able to build the program without  GNU make. This file documents the GNU make utility, which determines automatically which pieces of a large program need to be recompiled, and issues the commands to recompile them. This is Edition 0.75, last updated 17 January 2020, of The GNU Make Manual, for GNU make version 4.3.

Well, yes and no --- normally you would use an include file. Put your common configuration items together in a file, say common.mk and add

include common.mk

at the top of your makefile. If the flag doesn't have a matching way to configure it from inside the make file, you can use a function

function mk {
    make -j4 $*
}

Configuration (GNU Coding Standards), the parameters and initial settings for some computer programs. They are used for user applications, server processes and operating system settings. If you type ‘make distclean’, then make not only removes the same files as does ‘make clean’ but also the TAGS, Makefile, and config.status files. (Although it is not evident, this makefile (and config.status ) is generated by the user with the configure program, which is provided in the tar distribution, but is not shown here.)

It doesn't exist, but you can do this by having a recursive call into make.

For example:


Makefile:

-include $(HOME)/.makerc

.DEFAULT_GOAL: all

# This will handle a default goal if make is just called without any target
all:
    $(MAKE) $(MAKE_OPTIONS) -f Makefile.real $(MAKECMDGOALS)

# This handles all targets and passes it through
%:
    $(MAKE) $(MAKE_OPTIONS) -f Makefile.real $(MAKECMDGOALS)


$(HOME)/.makerc:

MAKE_OPTIONS := -j4

Configuration file, necessary to recompile them. In a program, typically the executable file is updated from object files, which are in turn made by compiling source files. If a language config-lang.in file (see The Front End config-lang.in File) sets outputs, then the files listed in outputs there are also generated. The following configuration headers are created from the Makefile, using mkconfig.sh , rather than directly by configure .

Linux make command information and examples, Make AC_OUTPUT create each file by copying an input file (by default file .in ), substituting the output variable values. This macro is one of the instantiating  GNU make. This file documents the GNU make utility, which determines automatically which pieces of a large program need to be recompiled, and issues the commands to recompile them. This is Edition 0.75, last updated 17 January 2020, of The GNU Make Manual, for GNU make version 4.3.

I like the MAKEFLAGS approach suggested by John Marshall in lieu of make supporting something like an automatic .makerc project config file. However, I didn't want to have to remember to source a .env or similar environment variables beforehand (and unsetting them afterward).

A solution to this is to put the MAKEFLAGS assignment at the top of the Makefile itself:

#!/usr/bin/env make

MAKEFLAGS=s

.PHONY: foo
foo:
    echo "hello, make"

Run it:

$ make foo
hello, make

Compared to running without the MAKEFLAGS=... line:

$ make foo
echo "hello, make"
hello, make

Configuration Files - Autoconf, configure && make && make install` works and where it comes from. Now that the software is built and ready to run, the files can be copied to their Since we'​re not following the standard layout of a GNU project, we warn  The configuration file is small and the configuration itself is fast and easy Brunch's config files can be extremely small compared to other alternatives. The fact that brunch also allows you to chose from a number of generators also lowers the configuration time considerably.

The magic behind configure, make, make install, where configure is a directory containing build configuration files and a Makefile , where dir1 , dir2 gnumake is the only command used to build a <top> area. Our configure script will expect a Makefile.in file that it can substitute all of those system-specific variables into, but so far, we’ve not created that file. Creating the Makefile As with the configure script, the Makefile.in template is very long and complex.

4. Build Facility, When using GNU make , relying on `VPATH' to find the source file will work in the Write the Makefile commands (and any shell scripts, such as configure ) to  GNU Make. GNU Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files. Make gets its knowledge of how to build your program from a file called the makefile, which lists each of the non-source files and how to compute it from other files. When you write a program, you

GNU make, This section describes how the Geant4 GNUMake infrastructure is by the following GNUmake script files ( *.gmk scripts are placed in $G4INSTALL/config ):​. Various distros may use a bit different naming for the same config file, e.g. CRUX has pkgmk.conf, but inside you'll find a very similar content to Arch's. Therefore you can safely modify makepkg and the compiler will use the defaults you've provided. Edit: spelling. Last edited by bohoomil (2012-05-22 20:31:57)

Comments
  • as far as that goes, alias make="make -j4". But aliases are so relatively inflexible and shell functions so straightforward that I almost always use functions.
  • How straightforward are they, really? You even have an error in this one: if any of your parameters to mk contain spaces, $* breaks; use "$@" instead.
  • And unquoted $* breaks in another way: it does pathname expansion; e.g. mk '*'. These breakages do matter, because while targets will almost never contain spaces, asterisks, brackets, or question marks, variables you pass to make ("make CFLAGS='-g -O2' target") might.