How to adding pathes to dependencies in rules of `.d` files

2023-03-04 Thread ljh
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

Re:How to adding pathes to dependencies in rules of `.d` files

2023-03-04 Thread ljh
$< # .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: $ ```

Re: How to adding pathes to dependencies in rules of `.d` files

2023-03-04 Thread ljh
| |-- 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

Re: How to adding pathes to dependencies in rules of `.d` files

2023-03-04 Thread ljh
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

Re: How to adding pathes to dependencies in rules of `.d` files

2023-03-04 Thread ljh
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

Makefile with out of source build Re: How to adding pathes to dependencies in rules of `.d` files

2023-03-04 Thread ljh
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

Re:Makefile with out of source build Re: How to adding pathes to dependencies in rules of `.d` files

2023-03-06 Thread ljh
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 heard peope say make is slow and recursive make is harmful

2023-03-06 Thread ljh
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

Header file dependency, rpath, soname and more with Makefile

2023-03-15 Thread ljh
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