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
7
votes
1 answer

How can I link my C code with the PCRE library? (Linker errors currently being thrown.)

The Problem Note: I originally had this problem in a much larger project; so I pared the code down to the test case you see below. I cannot figure out how to get the following test code to compile. Specifically, it appears as if the linker cannot…
7
votes
2 answers

Getting make to delete additional files on error

We're having some discussion lately about the way we handle .d files for dependencies in our make-based build process. The issue has been raised that sometimes the .d files can become corrupted when builds are interrupted. We're using the…
Dan Olson
  • 22,849
  • 4
  • 42
  • 56
7
votes
2 answers

Symlink (auto-generated) directories via Snakemake

I am trying to create a symlink-directory structure for aliasing output directories in a Snakemake workflow. Let's consider the following example: A long time ago in a galaxy far, far away, somebody wanted to find the best ice cream flavour in the…
mschilli
  • 1,884
  • 1
  • 26
  • 56
7
votes
3 answers

How can I detect if GHC is set to generate 32bit or 64bit code by default?

I have the following bits in my makefile: GLFW_FLAG := -m32 -O2 -Iglfw/include -Iglfw/lib -Iglfw/lib/cocoa $(CFLAGS) ... $(BUILD_DIR)/%.o : %.c $(CC) -c $(GLFW_FLAG) $< -o $@ $(BUILD_DIR)/%.o : %.m $(CC) -c $(GLFW_FLAG) $< -o $@ The -m32…
Jason Dagit
  • 13,684
  • 8
  • 33
  • 56
7
votes
1 answer

qmake with INCLUDEPATH ignores dependencies

I use qmake to build a project. The project contains several static libs and a executable. The executable links to the static libraries and therefore has the path of the library added to the INCLUDEPATH variable. When I change something in the…
David Feurle
  • 2,687
  • 22
  • 38
7
votes
2 answers

Makefile - How to call other makefiles with dependencies

Hey, I have a simple "master" Makefile who simply calls other makefiles. I'm trying to do the following in order to build components in the right order: LIB_A = folder_a LIB_B = folder_b LIB_C = folder_c MY_TARGETS = $(LIB_A) $(LIB_B)…
vdsf
  • 1,608
  • 2
  • 18
  • 22
7
votes
2 answers

Finding makefile dependencies

I have several widgets denoted by a config.xml in their root in a directory layout. The GNUmakefile I have here is able to build them. Though if I update the folders, the dependencies aren't tracked. I don't want to depend on a clean target…
hendry
  • 9,725
  • 18
  • 81
  • 139
7
votes
1 answer

Compile big C++ project that uses CMake to WebAssembly

I've been trying to compile a huge C++ project, that uses CMake to build the project, to wasm. I have almost no experience with CMake files and I am fighting this battle for months now. First I tried to install the webassembly compiler in my…
Pedro Mutter
  • 1,178
  • 1
  • 13
  • 18
7
votes
2 answers

Cross platform makefiles for small Haskell project?

I recently built a small, one-file Haskell utility to be included in 'tools' section of my otherwise pure PHP (raised eyebrows, I know) project. Initially I checked in both the .hs source file as well as the binary generated on my Linux development…
Anupam Jain
  • 7,851
  • 2
  • 39
  • 74
7
votes
1 answer

CMake cannot create MakeFile on Windows

When I tried to run cmake, it did generate a bunch of files but no MakeFile was created. CMakeLists.txt PROJECT(main) CMAKE_MINIMUM_REQUIRED(VERSION 3.16) AUX_SOURCE_DIRECTORY(. DIR_SRCS) ADD_EXECUTABLE(main ${DIR_SRCS}) main.c int main() { …
王子铭
  • 73
  • 1
  • 6
7
votes
1 answer

Confusing Sed One-Liner in Makefile Tutorial

Can anyone explain this sed one-liner in English (the more detail, the better)? @sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' < $*.d > $@; \ rm -f $*.d; [ -s $@ ] || rm -f $@ It's part of this…
Jason R. Mick
  • 5,177
  • 4
  • 40
  • 69
7
votes
1 answer

Building Makefile using bazel

I am trying to build Makefile of a submodule in a bazel project. I see that bazel does provide genrule to execute bash command. I am facing two issues currently - 1. How to cd into a directory before executing command, something like - genrule( …
Aditya
  • 5,509
  • 4
  • 31
  • 51
7
votes
2 answers

Getting last process' PID in Makefile

My Makefile look something like this: setsid ./CppServer>daemon.log 2>&1 & echo $!>daemon.pid What I expect it to do is to store the PID of my_awesome_script in corresponding file. However there's nothing there. So where's the problem?
Alex Bochkarev
  • 2,851
  • 1
  • 18
  • 32
7
votes
3 answers

Makefile: depend on every file of a directory

I'd like to do a Makefile that runs either with gnumake or makepp that packs all the files under given directiories: DIRS:=$(shell find . -mindepth 2 -maxdepth 2 -not -name mp3 -not -name ".*" -type d) PACKAGES = $(DIRS:%=%.npk) all:…
Gavriel
  • 18,880
  • 12
  • 68
  • 105
7
votes
4 answers

linux/kernel.h : No such file or directory

I am going to write a Hello World module in Ubuntu 10.10 (with the kernel 2.6.35-28-generic). Headers are located: /usr/src/linux-headers-2.6.35-28-generic hello.c: #include #include int init_module(void) { …
user663896