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
6 answers

How to handle setting up environment in makefile?

So, to compile my executable, I need to have the library locations set up correctly. The problem is, the setup comes from a bunch of scripts that do the env variable exporting, and what needs to be set up may change (beyond my control) so I need to…
polyglot
  • 9,945
  • 10
  • 49
  • 63
8
votes
1 answer

Linux kernel module compilation fails

My last kernel development was in version 2.6~ Now I try to compile a module, and I get the following error when compiling outside the kernel tree. /bin/sh: 1: /home/blabla/workspace/kernel35/linux-3.5/scripts/recordmcount: not found The object…
stdcall
  • 27,613
  • 18
  • 81
  • 125
8
votes
2 answers

Makefile Dynamic Rules w/ No GNU-make Pattern

I have a set of .cpp files that I want to compile. These .cpp files are in a hierarchical directory structure. I want the corresponding .o files to all end up in one build folder. Here's how I get GNU make to enumerate the files: SRCS = \ …
user2125275
  • 83
  • 1
  • 3
8
votes
2 answers

GNU Make "Abort trap: 6" after gcc call however call is valid when executed alone

I am using GNU Make to build a C/C++ project that many people will use. The makefile attempts to be general because there are many optional files in this project and each user selects those files through a MATLAB interface which are then provided to…
Alex Buck
  • 197
  • 2
  • 2
  • 10
8
votes
3 answers

Make target which depends on an environment variable

I work on a web app whose Makefile contains the following: dist/index.html: src/templates/index.html @bin/insert-scripts $< --output $@ bin/insert-scripts replaces <--scripts--> in the provided file with one of the following: a number of…
davidchambers
  • 23,918
  • 16
  • 76
  • 105
8
votes
1 answer

GNU Make producing a totally different result

This is confusing. I have my Makefile: OBJECTS = INCLUDE_BUILD_PATH = /Users/wen/Projects/include # Change compilation settings here COMPILE = g++ override COMPILE_FLAGS += -O2 # Change linker/compiler specific settings here LD_FLAGS := CC_FLAGS…
ihsoy ih
  • 1,008
  • 2
  • 10
  • 20
8
votes
2 answers

Iterating through a list of directories in a Makefile

I would like to execute a task in several directories but found no "makefile-like" solution up to now. I know this is an often asked question and I know how to solve it for sub-makfiles and so on, but I am looking for something simpler. Instead of…
Robert
  • 872
  • 3
  • 10
  • 15
8
votes
4 answers

Get base name of folder in GNU make

It seems the basename function as interpreted by GNU make is not the same as bash's basename. The former strips the suffix, while the latter will also strip the path. How can I get the base name of a folder in my makefile? Also, why in did they…
ari
  • 4,269
  • 5
  • 24
  • 33
8
votes
4 answers

How to know in a Makefile if `make` is invoked from ViM?

In short, I need to know in a Makefile whether `make is being invoked from ViM or not. Is there a certain variable (such as ENVIRONMENT or something), that ViM would set to a specific value?. The reason I need this is the following: If called from…
Shahbaz
  • 46,337
  • 19
  • 116
  • 182
8
votes
3 answers

How do I install an app into the data/app folder instead of the system/app folder in an AOSP build?

I put my application folder in packages/apps // inside AOSP source code Now my application has following Android.mk in the same folder: LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(call…
Jeegar Patel
  • 26,264
  • 51
  • 149
  • 222
8
votes
1 answer

Cygwin - Makefile-error: recipe for target `main.o' failed

I am currently failing to write a good makefile and don't know the reason why.. -.- This is my main.c: #include #include int main(int argc, char *argv[]) { printf("MEEEEEP"); return (0); } This is my makefile: # make…
Aureon
  • 387
  • 3
  • 4
  • 15
8
votes
4 answers

Why won't bundler install the json 1.7.4 gem on OS X 10.8?

I'm on OS X 10.8 with XCode 4.4, Ruby 1.9.3, and Rails 3.2. When I clone my rails project from git and run: bundle install I get: Installing json (1.7.4) Errno::EPERM: Operation not permitted -…
user2393462435
  • 2,652
  • 5
  • 37
  • 45
8
votes
5 answers

OSX 10.8, Xcode 4.4 Make and gcc gone from environment

I just upgraded to Mountain Lion OSX 10.8 and along with that I foolishly upgraded to Xcode 4.4. However, after this upgrade "make" is gone and things like gcc -v also do not work. This is a big thing since I am writing my phD and I rely on make to…
Kris
  • 2,100
  • 5
  • 31
  • 50
8
votes
5 answers

What the role of a target in a Makefile?

I was under an impression that the left hand side of the colon : represent target i.e. the executable file, and the right hand side represents 'dependencies', i.e. the files needed to produce the said target. hello : hello.c gcc hello.c -Wall…
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
8
votes
5 answers

VIM: is there an easy way to manage Visual Studio solutions / makefile projects from Vim?

I tried using Visual Studio instead of VIM(+plugins), but to be honest - the only advantage of VS over VIM is it's ability to automatically manage my project. I know of existence of ViEmu for VS, but I would like to do the opposite - is there any…
zeroDivisible
  • 4,041
  • 8
  • 40
  • 62