Questions tagged [gnu-make]

This tag is for questions about `gmake`, the GNU version of the `make` utility to maintain and update programs.

GNU Make is the GNU implementation of the Make utility. It is probably the most common version in use today.

GNU Make supports extensions to the Make language beyond the POSIX standard, therefore GNU Make solutions may not work under other versions, so the gnu-make tag is appropriate for questions from those using GNU Make, or pertaining to makefiles written for it.

Documentation

The latest GNU Make manual can be found in several formats here.

See also

make makefile

4424 questions
1
vote
1 answer

makefile rule to update a variable number of targets with a batch compile

We have a proprietary compiler that can take a number of input files and process them at once: compiler a.in # produces a.out compiler a.in b.in c.in # produces a.out b.out c.out The reason to do that is that is saves a lot of time for…
Fyodor
  • 13
  • 3
1
vote
0 answers

GNU Make rule not detecting .o files from dependencies

I'm having issues with rule B in my Makefile. I would like to be able to call make B to compile my project, but I get a large error message because it doesn't detect the .o files generated by the dependencies. However, it is able to detect the .o…
Quinn
  • 81
  • 1
  • 4
1
vote
1 answer

Can GNU make have targets that depend on the completion of targets from other makefiles?

I have several directories representing subparts of a project, each with its own Makefile. I want to create a master Makefile with targets for each of those subparts, each target satisfying the following: depend on a certain target from that…
Dan
  • 3,490
  • 2
  • 22
  • 27
1
vote
1 answer

Makefile with `ifeq` test for specific file

I am trying to set an if test for a specific file in my Makefile to compile it with different flags: .f90.o: ifeq ($<,main.f90) @echo ok $< $(F90) -c $< -o $@ else @echo nope $< $(F90) $(F90FLAGS) $(DEBUG) $(INCL) -c $< -o…
1
vote
1 answer

Is it possible to print variables and change them consequently in Makefile?

I have the following Makefile: all: print1 print2 world=world1 print1: @echo $(world) world=world2 print2: @echo $(world) .PHONY: all print1 print2 When running with make I expected to get: world1 world2 But I got: world2 world2 Is it…
Kenenbek Arzymatov
  • 8,439
  • 19
  • 58
  • 109
1
vote
2 answers

Key value pair in MAKEFILE

I am new in makefle, I had need array in makefile then I found that I can achieve that having variable that their items separated with spaces, and then iterating over it. Now I want something like map(key,value) pair to store values with keys.…
ant_dev
  • 653
  • 8
  • 16
1
vote
1 answer

How to have multiple (non-file) dependencies in a Makefile

I have a Makefile of the following form: upload_image_local: build_image_local ; echo "This gets printed" ; upload_image with build_image_local: echo "This is build_image_local" ./my_shell_script_1.sh $(SOME_ENV_VAR_1) upload_image: echo "This…
BlameMe
  • 61
  • 7
1
vote
2 answers

Evaluate function with two arguments in foreach loop in Makefile

I need to call a function with two parameters inside a foreach loop define obj-goal $1: $2 gcc $(CXXFLAGS) -c $$< -o $$@ endef Two arguments for the function are coming from two lists C_FILES:=$(patsubst…
1
vote
1 answer

Trick gmake build/ Copying files to preserve time stamps and avoid complete rebuild

short background info: For some rather convoluted reasons I am trying to trick my projects build system. We are working with Code Composer Studio on Windows from Texas Instruments and the gmake implementation that was included. We use the standard…
Mange_Man
  • 41
  • 1
  • 6
1
vote
2 answers

Possible bug in GNU make 4.3?

I have the following line in the Makefile of a software I'm working with: VERSION = $(subst $(space),.,$(wordlist 1,2,$(subst ., ,$(patsubst v%,%,$(shell cat VERSION))))) Where VERSION is a file containing the exact version of the software (f.e…
spotHound
  • 320
  • 2
  • 15
1
vote
1 answer

Target dependent source files in gnu make

My project is a firmware that has a common logic part which is device independent and a device dependent part. Now I want one (phoney) target to build device A and one (phoney) target to build device B. Both targets shall ideally produce the same…
Semo
  • 111
  • 1
  • 10
1
vote
2 answers

Makefile running export env having issue

I've created a Makefile to export a kubeconfig from fixed path like: myproj - .kube //folder config //file which contain the config - Makefile. //same level as .kube folder Now when I'm running from the terminal the following it…
NSS
  • 755
  • 1
  • 11
  • 30
1
vote
1 answer

Makefile target to add k8s cluster config

I want, in one command with args to config kubeconfig, that is able to connect to k8s cluster. I tried the following which does not work. cfg: mkdir ~/.kube kube: cfg touch config $(ARGS) In the args the user should pass the config file…
NSS
  • 755
  • 1
  • 11
  • 30
1
vote
1 answer

Makefile with user input validation

I've make file with target that needs some variable (token) as pre-requisite e.g. token = deploy: http://api.run.cf.com $(token) I need that the user enter the token (to the file) before he run the make deploy If not provide some error, how…
NSS
  • 755
  • 1
  • 11
  • 30
1
vote
1 answer

how to write a general makefile based on a simple list of sources

I have a list of files such as: SOURCES = program1.txt \ program2.txt \ ... \ program_n.txt from which I want to generate, when specified, handlers in C, Python, etc. These will later be compiled/included by a top…
picatostas
  • 58
  • 8