Comments (4)
Could you take a look at Rules.mk of example 2 in repository?
I think this answers your problem - just take a look at directory structure of this example and what it's Rules.mk is trying to achieve.
Best regards
Andrzej
from nonrec-make.
Hmm. Yes, using
Thanks,
James
from nonrec-make.
I'm not sure I fully understand your need. My guess that in 'a' you want to have a library with all object files from 'a' and all its subdirectories (recursively) - then in a/Rules.mk I would simply put (I'm guessing that .o extension in your example is not intentional and you wanted to collect all objects into archive):
SUBDIRS = b1 b2 b3
# Just in case there are *.c in 'a'
SRCS := *.c
LIB_A := $(OBJPATH)/liba.a
$(LIB_A)_DEPS = $(call get_subtree,OBJS,$(d))
TARGETS := $(LIB_A)
Then all Rules.mk under 'a' could be simple SRCS = *.c
with additional SUBDIRS
in case of a/b2/Rules.mk. I would say that this is even more readable since you can nearly read _DEPS line in English but they say that "beauty is in the eye of beholder" so you may very well disagree :).
from nonrec-make.
Finally catching up on this after a gap of a few months. :-\
Regarding the library vs. object thing... This is an old codebase, and I'm trying to drop in nonrec-make as transparently as possible. Yes, it actually is liba.o
. In this case, the files in each subdirectory were built into b1.o, b2.o (containing c1.o and c2.o) and b3.o, and the b*.o files were combined into liba.o. Out of those, my structure got rid of all but b2.o.
The $(LIB_A)_DEPS = $(call get_subtree,OBJS,$(d))
works nicely, and I think I've convinced myself the extra perceived complexity is fine (calling get_subtree once rather than the three times I thought I'd have to), so I've switched to that for now. I agree with you about it being more readable... I'm just trying to think about what problems I'll encounter when people without a good understanding of Make have to add or modify a Rules.mk file.
Thanks.
from nonrec-make.
Related Issues (19)
- SUBDIRS question HOT 6
- How to shorten OBJPATH when doing out-of-tree builds HOT 6
- Extending functionality without touching the source of nonrec-make HOT 2
- Overwriting system defined compilers HOT 2
- not a layer?socute HOT 15
- make dist_clean and custom OBJDIRs HOT 3
- In xxx.d files .I think it should be like xxx.o xxx.d:xxx.c x1.h x2.h \n xxx.c x1.h x2.h: HOT 2
- Uppercase and lowercase for same word mixed together HOT 3
- Autogenerated / Installed source and dependencies HOT 4
- Build vs. target targets HOT 8
- Bug in the config-default.mk file HOT 1
- Can I compile exe and so in one directory hierarchy both? HOT 2
- Install example HOT 8
- License HOT 2
- Is it possible to make it even simplier? HOT 3
- Suggestion: Include targets in default clean rule HOT 2
- Idea: Use order-only prerequisites for $(OBJPATH) HOT 4
- tgt_rule changes order of dependencies HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nonrec-make.