473,657 Members | 3,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1561
"matthias_k " <no****@digital raid.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
3482
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 recompile it with -DEAPI) So I googled what I can, and have read various responses. Most say you just need to recompile the module with the DEAPI flag. I was getting the same message for mod_php, and fixed that. However, with the same config...
16
2513
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 programmer-docs. I created a simple c++ project and deleted the src subdir and copied my sourcecode files into the basedir. (That's not where I want to let them in the end, but I thought it might be easier in the beginning) Then I copied the sample...
6
2267
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 need rules because they're not compiled. What can I do? Below is the makefile. Note that this makefile calls another makefile, and it seems the error comes from this fact.
0
1438
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 connectby function to work as i use it all the time. Can anyone suggest anything that i can do to get the connectby function
2
1925
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 I can upload it to fpga and processor. example, if we get hello.c. how to compile it to makefile.c?
2
1551
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 ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
33
2851
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 (tried: visual studio 2005 + linux/macintosh gcc)... That's a pretty good thing. I think the error still appears using both gcc and visual studio 2005. Everything is standard C (ANSI C ?? I don't know the difference) - but since so many functions...
5
3297
by: M.Liang Liu | last post by:
I have a project with the following dirs: --------------------------------------------------------------------------------------- +src |-proj0 |-program1 |-program2 |-proj1 |-program1 |-program2 |-program3
0
214
by: Paul Anton Letnes | last post by:
>
0
8302
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.