473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Please help with C++ Makefile and % Operator

Hello,

I am currently working on a Makefile mechanism which can for most
parts create dependencies automatically and look for sources in
other folders than "." .

As a basis, I have been adopting some mechanisms of the way the CDT
plugin for Eclipse handles this. However, at one point, I really don't
get what it's doing:

<snip>
# Makefile

[...]

-include $(SUBDIRS:%=%/subdir.mk)

[...]
</snip>
<snip>
# code is a subdir containing code
# code/subdir.mk

# Each subdirectory must supply rules for building sources it contributes
code/%.o: code/%.cpp
@echo 'Building file: $<'
$(CC) $(CFLAGS) -o $@ $< && \
echo -n $(@:%.o=%.d) '' > $(@:%.o=%.d) && \
$(CC) -MM -MG -P -w $(CFLAGS) $< >> $(@:%.o=%.d)
@echo 'Finished building: $<'
@echo ' '
</snip>

Okay, I know that in that include directive, all entries in SUBDIRS
are substituted in a way that "/subdir.mk" is attached to the end.
However my question is:
What does that mysterious % Operator do? I have searched the net with no
results. I have searched the bash manpage but it doesn't seem to be a
shell variable either.

Can you tell?

Thanks in advance,
- Matthias
Jul 22 '05 #1
1 1546
"matthias_k" <no****@digitalraid.com> wrote...
I am currently working on a Makefile mechanism which can for most
parts create dependencies automatically and look for sources in
other folders than "." .

[...]


Try gnu.utils.* or the newsgroup for your OS. Makefiles are OT here.
Thank you.

V
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ggg | last post by:
In regards to mod_python, I keep getting this warning when I do apachectl configtest: Loaded DSO libexec/mod_python.so uses plain Apache 1.3 API, this module might crash under EAPI! (please...
16
by: Henri Schomäcker | last post by:
Hi folks, I am developing a apache2 so module in c++. At the moment, I'm trying to get it to compile with automake & friends, but don't get it to work. I tried to modify the example in the...
6
by: jmborr | last post by:
While running make, I obtain the following error: make: *** No rule to make target `amino_acid_param.h', needed by `pdb2txt_relax.o'. Stop. I'm confused, since header files (*.h) shouldn't...
0
by: Murray Bryant | last post by:
I am having problems with contrib/tablefunc in postgresql 7.4.1 on freebsd when i try to make install i get the errors below. I am unable to make the 7.3 -> 7.4 transition until i can get the...
2
by: Tony | last post by:
Hi, Now I am doing some programming on Openrisc processor on FPGA. with Xilinx tools set we can upload the makefile to it and run. the problem is how can I complie the c file to makefile which...
2
by: David Garamond | last post by:
Does it currently work? src/backend/utils/mb/conversion_procs/*/ is not building anything, and 'make install' fails because it tries to copy *.so files. -- dave ...
33
by: Martin Jørgensen | last post by:
Hi, In continuation of the thread I made "perhaps a stack problem? Long calculations - strange error?", I think I now got a "stable" error, meaning that the error always seem to come here now...
5
by: M.Liang Liu | last post by:
I have a project with the following dirs: --------------------------------------------------------------------------------------- +src |-proj0 |-program1 |-program2 |-proj1 |-program1...
0
by: Paul Anton Letnes | last post by:
>
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.