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

Properly build a git submodule with gnu make

I currently try to write a Makefile that build properly a project which contains a git submodule. This submodule have its own set of makefiles and produce several targets at once, including some libraries. This Makefile should have the following…
Celelibi
  • 1,431
  • 1
  • 12
  • 30
8
votes
1 answer

Using pkg-config with autotools

I'm learning about the autotools and made it through a hello world scenario and now wanted to try wrapping up some cppunit tests into a package and build it using the autotools. In order to build the package, cppunit would have to be installed on…
Stephen Burke
  • 882
  • 3
  • 10
  • 25
8
votes
1 answer

How can I re-use a variable containing a timestamp throughout a Makefile run

I'm writing a simple Makefile to handle my document creation (PDF, HTML, LaTeX, EPUB, DOCX) from a series of Markdown text sources. Now I want to backup some intermediate files as copies in a separate directory, renaming them in the process by…
Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
8
votes
3 answers

Dynamic #include based on macro definition

I'm writing a C++ application in which I want to let the developer choose what algorithm to use for a particular problem at compile time. Both algorithms are implemented as C++ classes that implement a common interface, and are drop-in replacements…
Jon Gjengset
  • 4,078
  • 3
  • 30
  • 43
8
votes
1 answer

Linking SDL_image in make file

My Makefile - all: g++ main.cpp -I/usr/local/include -L/usr/local/lib -lSDL2 -lSDL_image My Code I am using as taken from a tutorial - /*This source code copyrighted by Lazy Foo' Productions (2004-2013) */ //Using SDL, SDL_image, standard IO,…
ILikeTurtles
  • 1,012
  • 4
  • 16
  • 47
8
votes
4 answers

How to build a boost dependent project using regular makefiles?

I'm working on a c++ project, and we recently needed to include a small part of boost in it. The boost part is really minimal (Boost::Python), thus, using bjam to build everything looks like an overkill (besides, everyone working on the project…
Fabzter
  • 505
  • 5
  • 16
8
votes
3 answers

Makefile and rsync error: Failed to exec ssh: No such file or directory

I'm trying to publish local files on a mac to my server using rsync and a makefile. When running the make command i get the following error: rsync: Failed to exec ssh: No such file or directory (2) rsync error: error in IPC code (code 14) at…
user2373001
  • 77
  • 1
  • 1
  • 3
8
votes
2 answers

C++ makefile on Linux with Multiple *.cpp files

I'm trying to make a makefile with multiple files. Can someone help me? The files I have are file1.cpp, file2.h and main.cpp file1.cpp contains my functions. file2.h contains the declaration of my functions. main.cpp [includes file2.h in the…
NewFile
  • 501
  • 5
  • 10
  • 16
8
votes
1 answer

How to make a Makefile for a program for assembly Language?

I've come across this task to build a Makefile for a program in assembly language I made (nothing fancy, like a hello world). The program is in Linux 32 bits and I'm using NASM assembler. So far I can only find Makefiles for programs for C, I'm…
Ale Rojas
  • 497
  • 2
  • 7
  • 17
8
votes
2 answers

Out of tree kernel modules: Multiple module, single Makefile, same source file, different build options

I am building a set of Linux kernel modules using shared source code. From what I understand, the Makefile has to be named "Makefile" so I have to use the same Makefile to build two different modules. How can I build two different modules, within…
Safayet Ahmed
  • 698
  • 5
  • 14
8
votes
1 answer

Cannot find -lperl doing a makefile on c++

sorry about my bad english... Well, I'm now to linux, perl and c++, but I have to do some codes for the university and I'm getting some troubles while doing the makefile. I have a code in perl which is running perfectly. As well, I have a code in…
PhaSath
  • 166
  • 1
  • 12
8
votes
2 answers

CMake: What's the usage of "make depend"?

One of the targets generated by cmake is depend: The following are some of the valid targets for this Makefile: ... all (the default if no target is provided) ... clean ... depend ... edit_cache ... rebuild_cache What would be the…
B Faley
  • 17,120
  • 43
  • 133
  • 223
8
votes
1 answer

Conditionals in Makefile: missing separator error?

I want to write some conditionals in a Makefile, following the guide at http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_7.html#SEC72. However, I get the error Makefile:219: *** missing separator. Stop., where line 219 is…
andreas-h
  • 10,679
  • 18
  • 60
  • 78
8
votes
1 answer

How can I improve the Makevars file for a Rcpp (RcppEigen) package?

I have a R package for which I moved an MCMC algorithm containing matrix algebra to C++ using the RcppEigen package which dramatically improved the speed. However, R CMD check gives the following NOTE on Linux (Thanks to R-Forge): * checking…
Henrik
  • 14,202
  • 10
  • 68
  • 91
8
votes
3 answers

Compile any C Program using just "make" (From a Makefile)

I'm learning C Programming through "Learn C the Hard Way." I am currently (for quite a long time) on Exercise 2, which can be found here: http://c.learncodethehardway.org/book/ex2.html In the extra credit section, there is a challenge which asks us…
antigravityguy
  • 157
  • 1
  • 7