Open Lecrapouille opened 5 months ago
Hi, thanks for your message, feel free to do what you want with my project. I will definitively check yours ! Thank you
If you know how to compile several libs (targets) within a single Makefile in a generic way. I'm welcome to get it. I can do it, but the Makefile does not recompiled dirty parts after the 1st compilation. I've to rethink.
Haven't done it in a generic way, i try to keep things fairly simple, so i add rules specific to my needs when needed. Maybe you can try to list in a different file the name of the targets you want to build and their dependencies (improving my simple "sources.mk" file feature). What do you think ?
I think I get the idea, based on O'Reilly book "GNU Makefile": they know paths of folders holding the libs and holding their own Makefilfe. These pathes are used as rules and as dependencies.
Here is my prototype of top-level Makefile:
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
DIRS_WITH_MAKEFILE := $(dir $(call rwildcard,src,Makefile))
.PHONY: all $(DIRS_WITH_MAKEFILE)
all: $(TARGET_NAME)
$(TARGET_NAME): $(OBJS) $(DIRS_WITH_MAKEFILE)
linker command ...
%.o: %.cpp:
compile command ...
$(DIRS_WITH_MAKEFILE):
$(MAKE) --directory=$@
Sounds great ! I can't wait to see the results to your work ! Keep me informed !
Here a functional code:
This does not work yet with rwildcard maybe because of trailing '/'. Any on long term I'll refactorize my makefile
The V2 is almost here https://github.com/Lecrapouille/MyMakefile/tree/version-2 :) I'm almost done testing it. I need to write the API and update all my projects using it
Hi, I really like what you've came up with ! Even though I don't use C++, I will definitely try your v2. Have you tested it on all Windows, Unix/Linux and Mac ?
It compiles C files. I'm finishing validations on Linux, Mac, Emscripten, ExaequOS. I'm passing my first CIs on some project of mine but I'll have some minor regressions for sure ;) I do not have Windows and since I'm using bash or Unix command not sure it will work (probably on Cygwin stuffs)
Hi I also made a Makefile for Linux and Mac OS some years ago that I use for all my C++ projects. https://github.com/Lecrapouille/MyMakefile I'm currently not happy because I do not manage the creation of several libraries. I see your project, and I'll cherry-pick some ideas for the version 2. Please pick some of my rules :)