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

Leaving directory.....?

When I am compiling my code with makefiles (I have 12 makefiles) there is an error telling make.exe[1]: Leaving directory Error 2 what is the reason for this? Also what does the "Error 2 or Error 1 " mean?
Renjith G
  • 6,307
  • 9
  • 27
  • 26
8
votes
2 answers

tell if make is running on windows or linux

Is there a way to know in makefiles if GNU make is running on a linux OS or a windows OS? I've built a bash script that generates a makefile for building my app and it works fine on my Debian machine. I want to try to build it on MinGW/MSYS, but the…
Gianni Pisetta
  • 293
  • 1
  • 2
  • 8
8
votes
1 answer

linking pthread library issue

Am facing a problem that may be slightly complicated to explain and understand as giving the entire picture would be too big and difficult. Please excuse me for it. Consider the following Makefile: all: clients.so simulator backup …
Lipika Deka
  • 3,774
  • 6
  • 43
  • 56
8
votes
2 answers

Why exported variables in Makefile is not received by executable?

I have a makefile, where i am exporting variables which will be received by an executable, but surprisingly the executable is not receiving the exported values. Please help me. 31 test: 32 @ echo 33 @ echo "Testing Electric…
RajSanpui
  • 11,556
  • 32
  • 79
  • 146
8
votes
4 answers

make: *** No rule to make target `main.o'

here is the output from the console in Eclipse: **** Build of configuration Debug for project FatFstest **** make all make: *** No rule to make target `main.o', needed by `FatFstest.elf'. Stop. I am trying to build a project using the AVR…
Nathan
  • 835
  • 3
  • 11
  • 20
8
votes
7 answers

Best practices for a C++ portable opensource application

I am starting an open source cross platform project in C++. My development environment is Linux. There may be other developers who develop from different platforms as well. So I need some help in getting started with the configuration and…
Navaneeth K N
  • 15,295
  • 38
  • 126
  • 184
8
votes
1 answer

How to fix "Could not find a package configuration file ..." error in CMake?

I have been working on a project which uses rplidar_sdk and in the beginning, I was facing this problem: How can I link locally installed SDK's static library in my C++ project? Basically, the SDK generates the library in its local directory, and…
Milan
  • 1,743
  • 2
  • 13
  • 36
8
votes
3 answers

What are Header Files and Library Files?

Possible Duplicate: What's the difference between a header file and a library? Can anyone tell me what's the actual meaning of a header file and a library file and their difference? For example we include header file with .h extension in our…
karthik
  • 345
  • 3
  • 5
  • 11
8
votes
3 answers

Makefile for multi-file LaTeX document

I'm trying to simplify/improve the Makefile for compiling my thesis. The Makefile works nicely for compiling the whole thing; I've got something like this: show: thesis.pdf open thesis.pdf thesis.pdf: *.tex pdflatex --shell-escape…
Will Robertson
  • 62,540
  • 32
  • 99
  • 117
8
votes
2 answers

Critical section in parallel make file

I am trying to parallelize an old Makefile. In fact I need to make sure that some generator scripts are called not parallel before the compiling procedure starts. The generators are always called before the compile. Is there any way to establish a…
Stasik
  • 2,568
  • 1
  • 25
  • 44
8
votes
2 answers

Compile multiple **changed** source files at once in GNU make

I know there have been several questions with similar titles but none seem to provide an answer to what I need (correct me if I'm wrong). Consider this makefile: SOURCES=file1.cpp file2.cpp…
Igor Skochinsky
  • 24,629
  • 2
  • 72
  • 109
8
votes
4 answers

Header Files in Multiple Directories: Best Practices

I'm a C Newb I write lots of code in dynamic languages (javascript, python, haskell, etc.), but I'm now learning C for graduate school and I have no idea what I'm doing. The Problem Originally I was building all my source in one directory using a…
brad
  • 73,826
  • 21
  • 73
  • 85
8
votes
2 answers

Dockerfile build remove source code from final image

I am new to Docker. I want to build a docker image by building a c++ library using make command. The way I am doing it in Dockerfile is that copy the source code from host install required packages run make copy the libraries (.so) into different…
shubham pagui
  • 145
  • 1
  • 6
8
votes
1 answer

Makefile ifeq problem

I am trying to use ifeq in my rule pattern and I have problems with it. This is the rule I am having trouble with: $(OBJS): $(OBJDIR)/%.o : ../%.c @mkdir -p $(dir $@) ifeq(mcc.exe,$(CC)) o_file:=$(shell echo $@ | sed -e…
Nikola
  • 221
  • 1
  • 4
  • 7
8
votes
3 answers

Problem with compiling RInside examples under Windows

I am trying to setup RInside at work where we are forced to use a Windows environment. I have installed RTools and downloaded an RInside binary from CRAN. My R installation resides in c:\R\R-2.12.2 so no problems with folders with spaces. I have…
Christian Bøhlke
  • 779
  • 1
  • 7
  • 18