will not take effect.
Now, If I `touch` my `.h` files, it will not re-build the source files.
Is there a way to inform `make` to add path to the prerequisites too?
Thanks
$ cat build/build/foo/foo.d
/home/ljh/Documents/make/src/build/build/foo/foo.o: foo.c foo.h
foo.h:
$
$ tree --charset C
$< # .cpp
-include $(shell find . -type f -name "*.d")
clean : ; -rm -fr $(DIR)
.PHONY : clean
```
The `.c`, `.h` files in the `.d` files are left without paths.
```
$ cat build/foo/foo.d
/home/ljh/Documents/make_outofsrc/src/build/foo/foo.o: foo.c foo.h
foo.h:
$
```
| |-- libfoo.so ->
/home/ljh/Documents/hello_makefile_OutOfSRC/src//objdir_tmp/foo/libfoo.so.6.2.3
| |-- libfoo.so.6 ->
/home/ljh/Documents/hello_makefile_OutOfSRC/src//objdir_tmp/foo/libfoo.so.6.2.3
| `-- libfoo.so.6.2.3
`-- main
|-- main
|-- main.d
`-- mai
Can you please give me suggestions to improve it.
1. In thie out of source version, I can not omit recipes in both building and
linking rules. This make it a bit complicated.
2. if I put # comment at the end of the line of export OBJDIR, it causes
mysterious error message in rules involve the v
Updated. Accept a path parameter on command line from the user.
# Makefile for top dir
# $(call version_number,1.2.3)
# major.minor.patch
# libtool manual 4.2: -version-number
define version_number
$(MAKE) -C $@ soname=lib$@.so.$(word 1,$(subst ., ,$(1)))
@ cp $(OBJDIR)/$@/$@ $(OB
Updated. Suggestions are most welcome.
Thanks
---
# Makefile for top dir
# $(call makever,1.2.3)
# major.minor.patch
define makever
$(MAKE) -C $@ soname=lib$@.so.$(word 1,$(subst ., ,$(1)))
@ cp $(OBJDIR)/$@/$@ $(OBJDIR)/$@/lib$@.so.$(1)
@ cd $(OBJDIR)/$@; ln -f -s $(OBJDIR)/$@/lib$@.s
Update. I did not use addprefix in the link rule.
# Makefile for top dir
# $(call makever,1.2.3)
# major.minor.patch
# libtool manual: -version-number
define makever
@ $(MAKE) -C $@ soname=lib$@.so.$(word 1,$(subst ., ,$(1)))
@ cp $(OBJDIR)/$@/$@ $(OBJDIR)/$@/lib$@.so.$(1)
I split my project into modules, eg. main, foo.
The main module calls foo which is shared object library.
If I change the foo.c (not the interface foo.h),
only foo.c is compiled and foo is linked.
So, is not what people say a matter of project organization?
$ pwd
/home/ljh/Documents
Hi community,
Currently, I can handle these tasks in C and C++ programming with Makefile:
1. Header file dependency;
2. rpath (for build and install);
3. soname for so versioning;
4. Debug or Release mode;
5. out-of-source build;
I want to know if there are some other tasks which are missing fro