Questions tagged [makefile]

A makefile is an input file for the build control language/tool make. It specifies targets and dependencies along with associated commands to perform (a.k.a. recipes) to update the targets.

A makefile is usually an input file for the build control language/tool make. The make utility and the corresponding makefile format is standardized by POSIX.

Common newbie mistakes:

Makefile variable assignment error in echo - running two distinct commands in a recipe and not realizing the shell from the first will exit and lose any changes to the environment.

Make implementations

More information

25125 questions
8
votes
1 answer

Setting Makefile variable to result of command in rule

I am trying to assign the result of a command to a variable in GNU make. It works if I do it outside the rule: $ cat stack.mk GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD) all: @echo Git branch is $(GIT_BRANCH) $ make -f stack.mk…
Stephen Rasku
  • 2,554
  • 7
  • 29
  • 51
8
votes
3 answers

error: unknown type name 'u_char' in OSX 10.11.2

I'm new to osx and I have some problems.I tried to makefile but come up with: error: unknown type name 'u_char'; did you mean 'char'? I referred to C PCAP library unknown types error ,add -D_BSD_SOURCE CFLAGS to my makefile, but it doesn't…
Jian Guo
  • 708
  • 1
  • 9
  • 19
8
votes
2 answers

ROS - Compilation fails due to Bzip2 libraries

I'm trying to compile a package using Ros Indigo. I'm using a Raspberry Pi running Raspbian. The BZIP2_LIBRARIES BZIP2_INCLUDE_DIR are missing. When I run the make command, I get the following error: -- +++ processing catkin package:…
UserK
  • 884
  • 3
  • 17
  • 40
8
votes
1 answer

Iterating over an empty item with GNU make's $(foreach)

I just discovered GNU make's $(foreach) function, and I'm following the foreach-eval-call pattern used in the documentation; for instance, graphviz_progs := dot neato circo fdp define LAYOUT_template %-$(1).dot: %.dot $(1) -Tdot $$? >…
reinierpost
  • 8,425
  • 1
  • 38
  • 70
8
votes
1 answer

How to compile C code that is using kernel function in docker and use pci device in container?

I have a Makefile some C++ code that is using PCI device all: g++ -o executable main.cpp dragon.pb.cc -std=c++11 -O3 -I/usr/include/postgresql -I/usr/include/hiredis -lzmq -lprotobuf -lpthread -lpq -lhiredis clean: rm executable And It…
user1685095
  • 5,787
  • 9
  • 51
  • 100
8
votes
1 answer

Linux "make" command Error 127

I'm new to Linux and trying to install mktorrent (latest version) and the README file states to simply run the 'make' command while in the directory. However, after trying 3 different terminals/emulators I would receive the same error as shown…
MerKury
  • 83
  • 1
  • 1
  • 3
8
votes
1 answer

How to run custom commands during `make uninstall` from qmake in QT5?

I have a QT project that installs a service to the system, when running make install. The relevant parts of the .pro file are the following: init.path = /etc/init.d/ init.files = myservicename updaterc.path = /etc/init.d/ updaterc.extra = chmod 755…
user000001
  • 32,226
  • 12
  • 81
  • 108
8
votes
1 answer

CMake does not find OpenCV libraries

Similarly to this question, I have troubles using OpenCV and CMake on OS X 10.10.3. After much hassle, I finally managed to build the OpenCV 3.0 beta on my system; the headers now reside in /usr/local/include and the libs – as they should – are in…
oarfish
  • 4,116
  • 4
  • 37
  • 66
8
votes
1 answer

How to include path prefix in GNU Make pattern rule

Consider the following: %.foo: %.bar echo $< > $@ Assuming we have one file 1.bar, the command executed is simply echo 1.bar > 1.foo. However, when % contains a path, rather than just a file name, it start becoming finicky. My problem is that…
Gx1sptDTDa
  • 1,558
  • 2
  • 11
  • 23
8
votes
1 answer

Specify Crypto++ library in a CMakeLists file

I am trying to specify the Crypto++ library in my CMakeLists file but I always get an error. Here is my CMakeLists file: cmake_minimum_required(VERSION 2.8) project( Recognition ) find_package( OpenCV REQUIRED ) find_package ( CURL REQUIRED…
Omar Lahlou
  • 1,000
  • 9
  • 33
8
votes
5 answers

Insert a new-line in a Makefile $(foreach ) loop

I'm compiling a large list of files in a Makefile. my.list : ${deps} rm -f $@ $(foreach F,$^,echo "${F}" >> $@;) but ${deps} can be large and the generated command-line could be too large for one SHELL call. Is it possible to replace ';' by…
Pierre
  • 34,472
  • 31
  • 113
  • 192
8
votes
2 answers

NetBeans Make Command when using MinGW

I'm trying to use NetBean to program C++, I have followed each of the commands found here: https://netbeans.org/community/releases/68/cpp-setup-instructions.html#compilers_windows However, I am having trouble with the make command option in…
Daniel Wootton
  • 103
  • 1
  • 2
  • 6
8
votes
1 answer

Makefile saying Missing Operator

I am trying to run a makefile that compiles these 'C' programs at the same time. CC=gcc CFLAGS=-I. DEPS = queue.h all: \threadss threadss: thread.o queueImp.o $(CC) thread.o queueImp.o -o threadss thread.o: thread.c $(CC) $(CFLAGS)…
M_Row
  • 109
  • 3
  • 12
8
votes
2 answers

Makefile: Converting C-code to mex code (Linking error)

I have a C-code which works fine using makefile. Now, I am trying to convert it to mex file so that I can run it from Matlab. Here also, I am using makefile approach. But, makefile for mex gives me error. Here is the tsnnls lib that I want to…
Garima Singh
  • 1,410
  • 5
  • 22
  • 46
8
votes
0 answers

qmake: make uninstall tries to remove system folders containing files installed with INSTALLS

This is my .pro file: TEMPLATE = app TARGET = myapp INCLUDEPATH += . win32 { RC_FILE = win32/myapp.rc } unix { target.path = /usr/share/myapp/ shortcutfiles.files += unix/myapp.desktop shortcutfiles.path = /usr/share/applications/ …
pr.nizar
  • 641
  • 6
  • 20