summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorjoshua stein <jcs@jcs.org>2019-12-24 20:36:04 -0600
committerAndreas Kling <awesomekling@gmail.com>2019-12-25 10:11:09 +0100
commitc127d1632679823d2cfe873895fad72aa52cfc87 (patch)
treebcfc370f214955e90c2a8f9891a187af5a042eaa /Libraries
parent2aeae2aea9a289e3e9ba96444e44169dd78cc1cb (diff)
downloadserenity-c127d1632679823d2cfe873895fad72aa52cfc87.zip
Build: support library and generator dependencies
Instead of directly manipulating LDFLAGS, set LIB_DEPS in each subdirectory Makefile listing the libraries needed for building/linking such as "LIB_DEPS = Core GUI Draw IPC Core". This adds each library as an -L and -l argument in LDFLAGS, but also adds the library.a file as a link dependency on the current $(PROGRAM). This causes the given library to be (re)built before linking the current $(PROGRAM), but will also re-link any binaries depending on that library when it is modified, when running make from the root directory. Also turn generator tools like IPCCompiler into dependencies on the files they generate, so they are built on-demand when a particular directory needs them. This all allows the root Makefile to just list directories and not care about the order, as all of the dependency tracking will figure it out.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibAudio/Makefile4
-rw-r--r--Libraries/LibC/Makefile15
-rw-r--r--Libraries/LibGUI/Makefile5
-rw-r--r--Libraries/LibHTML/CodeGenerators/Makefile3
-rw-r--r--Libraries/LibHTML/Makefile23
5 files changed, 41 insertions, 9 deletions
diff --git a/Libraries/LibAudio/Makefile b/Libraries/LibAudio/Makefile
index aad4b7122d..a7bda37485 100644
--- a/Libraries/LibAudio/Makefile
+++ b/Libraries/LibAudio/Makefile
@@ -4,6 +4,10 @@ OBJS = \
LIBRARY = libaudio.a
+AClientConnection.cpp: ../../Servers/AudioServer/AudioClientEndpoint.h
+../../Servers/AudioServer/AudioClientEndpoint.h:
+ @$(MAKE) -C $(dir $(@))
+
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibAudio/
cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/LibAudio/
diff --git a/Libraries/LibC/Makefile b/Libraries/LibC/Makefile
index 522e5c545b..76b3832838 100644
--- a/Libraries/LibC/Makefile
+++ b/Libraries/LibC/Makefile
@@ -1,3 +1,5 @@
+.NOTPARALLEL:
+
AK_OBJS = \
../../AK/StringImpl.o \
../../AK/String.o \
@@ -59,19 +61,22 @@ OBJS = $(AK_OBJS) $(LIBC_OBJS)
EXTRA_OBJS = setjmp.ao crti.ao crtn.ao
-.PHONY: startfiles
-startfiles: $(EXTRA_OBJS)
- $(CXX) $(CXXFLAGS) -o crt0.o -c crt0.cpp
+crt0.o: crt0.cpp
+ $(QUIET) $(CXX) $(CXXFLAGS) -o crt0.o -c crt0.cpp
+
+crtio.o: crti.ao
$(QUIET) cp crti.ao crti.o
+
+crtn.o: crtin.ao
$(QUIET) cp crtn.ao crtn.o
-EXTRA_CLEAN = crt0.d
+EXTRA_CLEAN = crt0.d crt0.o
DEFINES = -DSERENITY_LIBC_BUILD
LIBRARY = libc.a
-all: $(LIBRARY) startfiles install
+all: crt0.o $(EXTRA_OBJS) $(LIBRARY) install
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/sys/
diff --git a/Libraries/LibGUI/Makefile b/Libraries/LibGUI/Makefile
index cc54c54b11..25f23cec2e 100644
--- a/Libraries/LibGUI/Makefile
+++ b/Libraries/LibGUI/Makefile
@@ -63,6 +63,11 @@ OBJS = \
LIBRARY = libgui.a
+GWindowServerConnection.cpp: ../../Servers/WindowServer/WindowServerEndpoint.h
+
+../../Servers/WindowServer/WindowServerEndpoint.h:
+ @$(MAKE) -C $(dir $(@))
+
install:
mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibGUI/
cp ./*.h $(SERENITY_BASE_DIR)/Root/usr/include/LibGUI/
diff --git a/Libraries/LibHTML/CodeGenerators/Makefile b/Libraries/LibHTML/CodeGenerators/Makefile
new file mode 100644
index 0000000000..29af0b03ea
--- /dev/null
+++ b/Libraries/LibHTML/CodeGenerators/Makefile
@@ -0,0 +1,3 @@
+SUBDIRS := $(wildcard */.)
+
+include ../../../Makefile.subdir
diff --git a/Libraries/LibHTML/Makefile b/Libraries/LibHTML/Makefile
index c0a1672c0c..1ff6b91919 100644
--- a/Libraries/LibHTML/Makefile
+++ b/Libraries/LibHTML/Makefile
@@ -67,17 +67,28 @@ EXTRA_SOURCES = \
CSS/PropertyID.h \
CSS/PropertyID.cpp
+GENERATE_CSS_PROPERTYID_CPP = CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp
+GENERATE_CSS_PROPERTYID_H = CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h
+
+$(GENERATE_CSS_PROPERTYID_H):
+ @$(MAKE) -C $(dir $(GENERATE_CSS_PROPERTYID_H))
+
+$(GENERATE_CSS_PROPERTYID_CPP):
+ @$(MAKE) -C $(dir $(GENERATE_CSS_PROPERTYID_CPP))
+
CSS/DefaultStyleSheetSource.cpp: CSS/Default.css Scripts/GenerateStyleSheetSource.sh
@echo "GENERATE $@"
$(QUIET) Scripts/GenerateStyleSheetSource.sh default_stylesheet_source $< > $@
-CSS/PropertyID.h: CSS/Properties.json CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
+CSS/PropertyID.h: CSS/Properties.json $(GENERATE_CSS_PROPERTYID_H)
@echo "GENERATE $@"
- $(QUIET) CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h $< > $@
+ $(QUIET) $(GENERATE_CSS_PROPERTYID_H) $< > $@
-CSS/PropertyID.cpp: CSS/Properties.json CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
+CSS/PropertyID.cpp: CSS/Properties.json $(GENERATE_CSS_PROPERTYID_CPP)
@echo "GENERATE $@"
- $(QUIET) CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp $< > $@
+ $(QUIET) $(GENERATE_CSS_PROPERTYID_CPP) $< > $@
+
+EXTRA_CLEAN = CSS/DefaultStyleSheetSource.cpp CSS/PropertyID.h CSS/PropertyID.cpp
OBJS = $(EXTRA_OBJS) $(LIBHTML_OBJS)
@@ -91,3 +102,7 @@ install:
cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/
include ../../Makefile.common
+
+SUBDIRS = CodeGenerators
+
+include ../../Makefile.subdir