4,640 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
2
answers
67
views
Is it incorrect/undefined behavior when libraries are linked using relative path?
I am building a shared library A which depends on another shared library B present in another directory dir2. When I link shared library B to A with relative path using -L../dir2 -lB it builds fine. ...
-1
votes
1
answer
51
views
Makefile error when .PHONY target doesn't contain the output file names
The Makefile below throws the following error when compiled.
Error:
make: *** No rule to make target 'libfoo.so.0.1', needed by 'all'. Stop.
Makefile:
LIBNAME = libfoo
SOLIBNAME = $(LIBNAME).so.0.1
...
1
vote
1
answer
63
views
ifdef with target-specific variables
This Makefile specifies a target-specific variable and a global one
VAR=value
target: VAR2=value2
ifdef VAR
VAR3+=$(VAR)
endif
ifdef VAR2
VAR3+=$(VAR2)
endif
target:
@echo $(VAR) $(VAR2)...
2
votes
1
answer
63
views
Gnu make 4.3 Makefile change output directory of dynamic target
I am trying to compile .c-files and store the output .o-files into different folders. When making a debug-build, the output files should be stored in build/debug/. When making a release-build, the ...
Advice
5
votes
0
replies
111
views
optional prerequisites in gnu make
I have a project where I need to build a series of targets. If the target has a same-named 'suppsrc' file that can be transformed to a 'supplement' file, use that too.
That is, if I have a file a.in, ...
0
votes
1
answer
79
views
Why doesn't make fail if a file exists but there is no rule for it
The following is a minimal example from something odd that was happening to me. My situation was obviously more complex than what follows, but the "misunderstanding" boils down exactly to ...
0
votes
2
answers
69
views
How to apply the same recipe to different target with pattern?
Here is my Makefile. All the %.o depend on %.c and main.h, except the ones under main, event, cmd folder, which depend on $(MAIN_HEADERS).
How do I combine the below and make them simpler, as their ...
0
votes
1
answer
45
views
Why does my recursive Makefile target exit with ‘is up to date’ and no error, unless I redeclare all
I have a recursive Makefile setup where a root Makefile delegates builds to subdirectory Makefiles via $(MAKE) BUILDTARGET=.... Most subdirectories build fine, but the boot/ directory behaves ...
0
votes
1
answer
93
views
Makefile not building pattern rule prerequisites when it involves a chain [closed]
Consider this Makefile:
run-%: %
./$<
I have a test1.cpp file, so I expect make to build test1.o and test1 using chained implicit rules when I run make run-test1. However, what I get is
make: *...
-4
votes
1
answer
61
views
I want `make` to fail if an environment var is not specified
I want GNU make command to fail if the environment var AUTO_CALL is not specified.
I could do so:
.PHONY: x
x:
ifndef AUTO_CALL
@echo "Don't call `make` manually."
else
...
endif
...
2
votes
1
answer
57
views
GHC(Haskell) not picking up imports from makefile
I have been making a Haskell project that I want to continue on in C at some point through the FFI. I wanted to create a makefile to compile all the source with Clang for C and GHC for Haskell.
The ...
1
vote
0
answers
80
views
Usage of sed in Windows OS via Make
I am working on Windows OS. And here is my makefile snippet.
COMPILER_ROOT := C:/Users/kpt
DATE := $(COMPILER_ROOT)/build/busybox_glob.exe date
SED := $(COMPILER_ROOT)/build/busybox_glob.exe sed
...
1
vote
2
answers
63
views
gnu make executes commented $(info ) within define
I cannot comment out an info line inside a define. The following makefile shows the behavior (mind the tabs)
define tmpl
$(info info inside define, not commented, parameter is: $(1))
# $(info info ...
0
votes
0
answers
32
views
gcc-15.1.0 installation error on TinyCore64 Linux
While installing GCC-15.1.0 on
TinyCore64 Linux on
Oracle VirtualBox on
Windows 11 Home
on Acer Aspire Thin & Light Laptop with AMD Ryzen 5 5625U with 48GB (16GB+32GB) RAM & 512GB NMVe gen3.0
...
1
vote
1
answer
83
views
How to use shell-assignment operator with gmake?
I'm trying to keep my Makefile compatible between BSD and GNU make. It is not particularly complicated, but there is one spot, where I'd very much like to assign a value based on the output of a ...