25,699 questions
1
vote
1
answer
54
views
Conditional statement in makefile based on querying present working directory
From here, I realize it is possible to query the pwd.
I have the following 2 lines that I currently comment on/off
# LDLIBSOPTIONS=-L "/home/OpenXLSX/linux/lib"
LDLIBSOPTIONS=-L "/...
1
vote
1
answer
51
views
Using tee in a Linux makefile
I am trying to save the output of a makefile. I have tried everything that I can think of without success.
> >> tee compile.log
> 1> tee compile.log
> 2> tee compile.log
> &>...
-3
votes
0
answers
128
views
"Multiple definition" error in C++ with separate definition and declaration [closed]
So I have a header file with the following code:
#ifndef banana_h
#define banana_h
#include <string>
std::string foo(std::string a);
std::string bar(std::string b);
#endif
and the ...
0
votes
0
answers
144
views
Build fails as both LOCAL_SDK_VERSION and LOCAL_PRIVATE_PLATFORM_APIS are set
I'm beginning to customize my phone and I'm following this guide to build AOSP for an Xperia.
I selected aosp_arm64-eng target by running source build/envsetup.sh && lunch, then ran make -j$(...
2
votes
3
answers
160
views
How to create test executables in Makefile in C?
I want to build make test with Makefile, and the test target should generate <file_name>_test executable based on the folder tests/<file_name>.c. All tests/*.c files have a main() function....
3
votes
3
answers
169
views
How to write Makefile for debugging only one header and source in c
The lib folder contains many *.h and *.c files, and all files are in development phrase and they contain many errors including syntax errors. So I want to write the Makefile to debug all libraries one ...
2
votes
2
answers
135
views
Nested C Makefile
C/Makefile relative newbie here. I have a C project whose structure looks like this:
main.c
subdir1
a.h
a.c
b.h
b.c
subdir2
x.h
x.c
y.h
...
0
votes
1
answer
77
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
1
answer
49
views
How to pass -B (rebuild all) to submake
I am using an alternate make system tied in to the main make. The issue is when I do:
make -B
For rebuild all, it does not pass that to the submake. I want the submake to also do a rebuild.
The only ...
0
votes
1
answer
59
views
mingw32-make application was unable to start correctly (0xC0000142)
I installed mingw64 on my Windows 11 system a few days ago.
When using mingw32-make, the following code (lines 27 and 28) in the makefile is failing.
voice.exe: ${OBJS}
${CC} -o "$@" ${...
0
votes
2
answers
68
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 ...
1
vote
1
answer
62
views
Pattern rules not recognized for files with double suffixes?
I have a minimal Makefile with just this one pattern rule:
%: %.m4
m4 $< > $@
Then, with GNU Make:
touch foo.in.m4 ; make foo.in executes as expected: m4 foo.in.m4 > foo.in
but for foo....
1
vote
1
answer
129
views
Makefile to create .o and program file in separate directories depending on architecture of host PC
Trying to create a Makefile that compiles C source into a .o file in a subfolder as well as creating the executable in a different subfolder depending on the architecture of the host PC. When I run &...
0
votes
1
answer
104
views
Undefined reference to header only library [duplicate]
Goal
Use concise makefile with organized directory structure. In particular, I don't want to have to edit the makefile to manage dependencies with every new source addition. The assumed directory ...
0
votes
0
answers
68
views
Can't build a project in Visual Studio Code when there are two build steps, cmake and make
Visual Studio Code 1.104.1, running on Fedora 42 (Workstation Edition). I can't seem to be able to build a project that requires two build steps, cmake and make. Part of the problem is that I want to ...