From ac25438d54252d70de0002e4cca04ac258967c47 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Wed, 18 Dec 2019 17:35:46 -0600 Subject: [PATCH] Build: clean up build system, use one shared Makefile Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler. --- AK/Makefile | 5 + AK/Tests/Makefile | 18 +++- AK/install.sh | 4 - Applications/About/Makefile | 8 +- Applications/Browser/Makefile | 8 +- Applications/Calculator/Makefile | 16 ++-- Applications/ChanViewer/Makefile | 8 +- Applications/DisplayProperties/Makefile | 8 +- Applications/FileManager/Makefile | 10 +- Applications/FontEditor/Makefile | 9 +- Applications/Help/Makefile | 8 +- Applications/HexEditor/Makefile | 12 +-- Applications/IRCClient/Makefile | 8 +- Applications/Makefile | 3 + Applications/Makefile.common | 14 --- Applications/PaintBrush/Makefile | 8 +- Applications/Piano/Makefile | 8 +- Applications/QuickShow/Makefile | 8 +- Applications/SoundPlayer/Makefile | 12 +-- Applications/SystemDialog/Makefile | 8 +- Applications/SystemMonitor/Makefile | 8 +- Applications/Taskbar/Makefile | 8 +- Applications/Terminal/Makefile | 8 +- Applications/TextEditor/Makefile | 10 +- Applications/Welcome/Makefile | 8 +- Demos/Fire/Makefile | 20 +--- Demos/HelloWorld/Makefile | 20 +--- Demos/HelloWorld2/Makefile | 20 +--- Demos/Makefile | 3 + Demos/WidgetGallery/Makefile | 20 +--- DevTools/FormCompiler/Makefile | 15 +-- DevTools/HackStudio/Makefile | 20 +--- DevTools/IPCCompiler/Makefile | 15 +-- DevTools/Inspector/Makefile | 20 +--- DevTools/Makefile | 3 + DevTools/ProfileViewer/Makefile | 20 +--- DevTools/VisualBuilder/Makefile | 20 +--- Games/Makefile | 3 + Games/Minesweeper/Makefile | 20 +--- Games/Snake/Makefile | 20 +--- Kernel/Makefile | 38 ++++---- Kernel/install.sh | 4 - Libraries/LibAudio/Makefile | 19 +--- Libraries/LibAudio/install.sh | 8 -- Libraries/LibC/Makefile | 49 +++++----- Libraries/LibC/install.sh | 19 ---- Libraries/LibCore/Makefile | 19 +--- Libraries/LibCore/install.sh | 8 -- Libraries/LibDraw/Makefile | 19 +--- Libraries/LibDraw/install.sh | 8 -- Libraries/LibELF/Makefile | 1 + Libraries/LibGUI/Makefile | 19 +--- Libraries/LibGUI/install.sh | 8 -- .../Generate_CSS_PropertyID_cpp/Makefile | 47 ++++------ .../Generate_CSS_PropertyID_h/Makefile | 47 ++++------ Libraries/LibHTML/Makefile | 47 ++++------ Libraries/LibHTML/install.sh | 11 --- Libraries/LibIPC/Makefile | 19 +--- Libraries/LibIPC/install.sh | 8 -- Libraries/LibM/Makefile | 20 ++-- Libraries/LibM/install.sh | 9 -- Libraries/LibMarkdown/Makefile | 29 ++---- Libraries/LibMarkdown/install.sh | 8 -- Libraries/LibPCIDB/Makefile | 19 +--- Libraries/LibPCIDB/install.sh | 8 -- Libraries/LibProtocol/Makefile | 16 +--- Libraries/LibPthread/Makefile | 19 +--- Libraries/LibPthread/install.sh | 9 -- Libraries/LibThread/Makefile | 19 +--- Libraries/LibThread/install.sh | 8 -- Libraries/LibVT/Makefile | 16 +--- Libraries/Makefile | 3 + Makefile | 44 +++++++++ Makefile.common | 91 ++++++++++++++++--- Makefile.subdir | 17 ++++ MenuApplets/Audio/Makefile | 12 +-- MenuApplets/CPUGraph/Makefile | 12 +-- MenuApplets/Makefile | 3 + MenuApplets/Makefile.common | 14 --- Servers/AudioServer/Makefile | 25 ++--- Servers/AudioServer/install.sh | 4 - Servers/LookupServer/Makefile | 23 +---- Servers/Makefile | 3 + Servers/ProtocolServer/Makefile | 20 +--- Servers/SystemServer/Makefile | 25 ++--- Servers/SystemServer/install.sh | 4 - Servers/TTYServer/Makefile | 23 +---- Servers/TelnetServer/Makefile | 23 +---- Servers/WindowServer/Makefile | 22 ++--- Servers/WindowServer/install.sh | 4 - Shell/Makefile | 20 +--- Userland/Makefile | 22 ++--- 92 files changed, 527 insertions(+), 929 deletions(-) create mode 100644 AK/Makefile delete mode 100755 AK/install.sh create mode 100644 Applications/Makefile delete mode 100755 Applications/Makefile.common create mode 100644 Demos/Makefile create mode 100644 DevTools/Makefile create mode 100644 Games/Makefile delete mode 100755 Kernel/install.sh delete mode 100755 Libraries/LibAudio/install.sh delete mode 100755 Libraries/LibC/install.sh delete mode 100755 Libraries/LibCore/install.sh delete mode 100755 Libraries/LibDraw/install.sh create mode 100644 Libraries/LibELF/Makefile delete mode 100755 Libraries/LibGUI/install.sh delete mode 100755 Libraries/LibHTML/install.sh delete mode 100755 Libraries/LibIPC/install.sh delete mode 100755 Libraries/LibM/install.sh delete mode 100755 Libraries/LibMarkdown/install.sh delete mode 100755 Libraries/LibPCIDB/install.sh delete mode 100755 Libraries/LibPthread/install.sh delete mode 100755 Libraries/LibThread/install.sh create mode 100644 Libraries/Makefile create mode 100644 Makefile create mode 100644 Makefile.subdir create mode 100644 MenuApplets/Makefile delete mode 100755 MenuApplets/Makefile.common delete mode 100755 Servers/AudioServer/install.sh create mode 100644 Servers/Makefile delete mode 100755 Servers/SystemServer/install.sh delete mode 100755 Servers/WindowServer/install.sh diff --git a/AK/Makefile b/AK/Makefile new file mode 100644 index 00000000000..27ac225b0e8 --- /dev/null +++ b/AK/Makefile @@ -0,0 +1,5 @@ +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/AK/ + cp ../AK/*.h $(SERENITY_BASE_DIR)/Root/usr/include/AK/ + +include ../Makefile.common diff --git a/AK/Tests/Makefile b/AK/Tests/Makefile index f8b74f3bfc0..bd8ec67b83a 100644 --- a/AK/Tests/Makefile +++ b/AK/Tests/Makefile @@ -1,4 +1,20 @@ -PROGRAMS = TestBinarySearch TestAtomic TestString TestQueue TestVector TestHashMap TestJSON TestWeakPtr TestNonnullRefPtr TestRefPtr TestFixedArray TestFileSystemPath TestURL TestStringView TestUtf8 TestCircularQueue +PROGRAMS = \ + TestBinarySearch \ + TestAtomic \ + TestString \ + TestQueue \ + TestVector \ + TestHashMap \ + TestJSON \ + TestWeakPtr \ + TestNonnullRefPtr \ + TestRefPtr \ + TestFixedArray \ + TestFileSystemPath \ + TestURL \ + TestStringView \ + TestUtf8 \ + TestCircularQueue CXXFLAGS = -std=c++17 -Wall -Wextra -ggdb3 -O2 -I../ -I../../ diff --git a/AK/install.sh b/AK/install.sh deleted file mode 100755 index d0827c75025..00000000000 --- a/AK/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -mkdir -p ../Root/usr/include/AK/ -cp ../AK/*.h ../Root/usr/include/AK/ diff --git a/Applications/About/Makefile b/Applications/About/Makefile index 123a3b93929..7c830c994f2 100755 --- a/Applications/About/Makefile +++ b/Applications/About/Makefile @@ -1,8 +1,8 @@ -include ../../Makefile.common - OBJS = \ main.o -APP = About +PROGRAM = About -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lcore -lc + +include ../../Makefile.common diff --git a/Applications/Browser/Makefile b/Applications/Browser/Makefile index 19052144183..dcb43df5bf4 100755 --- a/Applications/Browser/Makefile +++ b/Applications/Browser/Makefile @@ -1,8 +1,8 @@ -include ../../Makefile.common - OBJS = \ main.o -APP = Browser +PROGRAM = Browser -include ../Makefile.common +LDFLAGS = -lgui -lhtml -ldraw -lprotocol -lipc -lcore -lc + +include ../../Makefile.common diff --git a/Applications/Calculator/Makefile b/Applications/Calculator/Makefile index ce81b1236fe..1b4302c106f 100644 --- a/Applications/Calculator/Makefile +++ b/Applications/Calculator/Makefile @@ -1,11 +1,11 @@ -include ../../Makefile.common - OBJS = \ - Calculator.o \ - Keypad.o \ - CalculatorWidget.o \ - main.o + Calculator.o \ + Keypad.o \ + CalculatorWidget.o \ + main.o -APP = Calculator +PROGRAM = Calculator -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lcore -lc + +include ../../Makefile.common diff --git a/Applications/ChanViewer/Makefile b/Applications/ChanViewer/Makefile index c31011fcf46..93109019003 100755 --- a/Applications/ChanViewer/Makefile +++ b/Applications/ChanViewer/Makefile @@ -1,10 +1,10 @@ -include ../../Makefile.common - OBJS = \ ThreadCatalogModel.o \ BoardListModel.o \ main.o -APP = ChanViewer +PROGRAM = ChanViewer -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/DisplayProperties/Makefile b/Applications/DisplayProperties/Makefile index a3d7d9462be..000a6c8727d 100644 --- a/Applications/DisplayProperties/Makefile +++ b/Applications/DisplayProperties/Makefile @@ -1,9 +1,9 @@ -include ../../Makefile.common - OBJS = \ DisplayProperties.o \ main.o \ -APP = DisplayProperties +PROGRAM = DisplayProperties -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/FileManager/Makefile b/Applications/FileManager/Makefile index b63aeabe61b..4a9e97aab32 100644 --- a/Applications/FileManager/Makefile +++ b/Applications/FileManager/Makefile @@ -1,11 +1,11 @@ -include ../../Makefile.common - OBJS = \ DirectoryView.o \ FileUtils.o \ - PropertiesDialog.o \ + PropertiesDialog.o \ main.o -APP = FileManager +PROGRAM = FileManager -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/FontEditor/Makefile b/Applications/FontEditor/Makefile index e45cef7eb7d..5713cec4e5c 100644 --- a/Applications/FontEditor/Makefile +++ b/Applications/FontEditor/Makefile @@ -1,17 +1,18 @@ -include ../../Makefile.common - OBJS = \ FontEditor.o \ GlyphMapWidget.o \ GlyphEditorWidget.o \ main.o -APP = FontEditor +PROGRAM = FontEditor -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lcore -lc FontEditor.cpp: UI_FontEditorBottom.h UI_FontEditorBottom.h: FontEditorBottom.frm ../../DevTools/FormCompiler/FormCompiler $< > $@ +EXTRA_CLEAN = UI_FontEditorBottom.h + +include ../../Makefile.common diff --git a/Applications/Help/Makefile b/Applications/Help/Makefile index 36b372dd7cf..d9fb7df6b4f 100644 --- a/Applications/Help/Makefile +++ b/Applications/Help/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ ManualModel.o \ ManualSectionNode.o \ @@ -7,6 +5,8 @@ OBJS = \ History.o \ main.o -APP = Help +PROGRAM = Help -include ../Makefile.common +LDFLAGS = -lgui -lhtml -lmarkdown -ldraw -lipc -lprotocol -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/HexEditor/Makefile b/Applications/HexEditor/Makefile index 390903bd808..2ce7c89bfe1 100644 --- a/Applications/HexEditor/Makefile +++ b/Applications/HexEditor/Makefile @@ -1,10 +1,10 @@ -include ../../Makefile.common - OBJS = \ - HexEditor.o \ + HexEditor.o \ HexEditorWidget.o \ - main.o + main.o -APP = HexEditor +PROGRAM = HexEditor -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/IRCClient/Makefile b/Applications/IRCClient/Makefile index 6fe66568320..e2b7766d62d 100644 --- a/Applications/IRCClient/Makefile +++ b/Applications/IRCClient/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ IRCClient.o \ IRCChannel.o \ @@ -11,6 +9,8 @@ OBJS = \ IRCChannelMemberListModel.o \ main.o -APP = IRCClient +PROGRAM = IRCClient -include ../Makefile.common +LDFLAGS = -lgui -lhtml -ldraw -lprotocol -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/Makefile b/Applications/Makefile new file mode 100644 index 00000000000..6a7b80e8952 --- /dev/null +++ b/Applications/Makefile @@ -0,0 +1,3 @@ +SUBDIRS := $(wildcard */.) + +include ../Makefile.subdir diff --git a/Applications/Makefile.common b/Applications/Makefile.common deleted file mode 100755 index 13ca4d4a945..00000000000 --- a/Applications/Makefile.common +++ /dev/null @@ -1,14 +0,0 @@ -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lmarkdown -lhtml -laudio -lipc -lvt -lpcidb -lgui -ldraw -lprotocol -lipc -lthread -lpthread -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d diff --git a/Applications/PaintBrush/Makefile b/Applications/PaintBrush/Makefile index dbdc6d8c3a6..b05e21f9ff4 100644 --- a/Applications/PaintBrush/Makefile +++ b/Applications/PaintBrush/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ PaintableWidget.o \ PaletteWidget.o \ @@ -14,6 +12,8 @@ OBJS = \ PickerTool.o \ main.o -APP = PaintBrush +PROGRAM = PaintBrush -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/Piano/Makefile b/Applications/Piano/Makefile index 1e194d9b4a0..250a26e8d9c 100644 --- a/Applications/Piano/Makefile +++ b/Applications/Piano/Makefile @@ -1,9 +1,9 @@ -include ../../Makefile.common - OBJS = \ PianoWidget.o \ main.o -APP = Piano +PROGRAM = Piano -include ../Makefile.common +LDFLAGS = -lgui -ldraw -laudio -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/QuickShow/Makefile b/Applications/QuickShow/Makefile index 7e03212941f..9874612ecde 100644 --- a/Applications/QuickShow/Makefile +++ b/Applications/QuickShow/Makefile @@ -1,9 +1,9 @@ -include ../../Makefile.common - OBJS = \ QSWidget.o \ main.o -APP = QuickShow +PROGRAM = QuickShow -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lprotocol -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/SoundPlayer/Makefile b/Applications/SoundPlayer/Makefile index 55f6d77d878..aac1e79ca71 100644 --- a/Applications/SoundPlayer/Makefile +++ b/Applications/SoundPlayer/Makefile @@ -1,11 +1,11 @@ -include ../../Makefile.common - OBJS = \ - PlaybackManager.o \ + PlaybackManager.o \ SampleWidget.o \ - SoundPlayerWidget.o \ + SoundPlayerWidget.o \ main.o -APP = SoundPlayer +PROGRAM = SoundPlayer -include ../Makefile.common +LDFLAGS = -lgui -ldraw -laudio -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/SystemDialog/Makefile b/Applications/SystemDialog/Makefile index 1bd260a73f9..732637b9a51 100755 --- a/Applications/SystemDialog/Makefile +++ b/Applications/SystemDialog/Makefile @@ -1,8 +1,8 @@ -include ../../Makefile.common - OBJS = \ main.o -APP = SystemDialog +PROGRAM = SystemDialog -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lcore -lc + +include ../../Makefile.common diff --git a/Applications/SystemMonitor/Makefile b/Applications/SystemMonitor/Makefile index 69a15d042b9..625d30a9913 100644 --- a/Applications/SystemMonitor/Makefile +++ b/Applications/SystemMonitor/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ ProcessModel.o \ DevicesModel.o \ @@ -12,6 +10,8 @@ OBJS = \ NetworkStatisticsWidget.o \ main.o -APP = SystemMonitor +PROGRAM = SystemMonitor -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lprotocol -lpcidb -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/Taskbar/Makefile b/Applications/Taskbar/Makefile index 04cc970041c..1bdca77abda 100644 --- a/Applications/Taskbar/Makefile +++ b/Applications/Taskbar/Makefile @@ -1,11 +1,11 @@ -include ../../Makefile.common - OBJS = \ TaskbarWindow.o \ TaskbarButton.o \ WindowList.o \ main.o -APP = Taskbar +PROGRAM = Taskbar -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lipc -lcore -lc + +include ../../Makefile.common diff --git a/Applications/Terminal/Makefile b/Applications/Terminal/Makefile index 0eb3bcb3bef..1b862da2f9f 100644 --- a/Applications/Terminal/Makefile +++ b/Applications/Terminal/Makefile @@ -1,8 +1,8 @@ -include ../../Makefile.common - OBJS = \ main.o -APP = Terminal +PROGRAM = Terminal -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lvt -lprotocol -lipc -lcore -lc + +include ../../Makefile.common diff --git a/Applications/TextEditor/Makefile b/Applications/TextEditor/Makefile index 32e76a8d439..342640c6bea 100755 --- a/Applications/TextEditor/Makefile +++ b/Applications/TextEditor/Makefile @@ -1,9 +1,9 @@ -include ../../Makefile.common - OBJS = \ TextEditorWidget.o \ - main.o + main.o -APP = TextEditor +PROGRAM = TextEditor -include ../Makefile.common +LDFLAGS = -lgui -ldraw -lvt -lipc -lthread -lpthread -lcore -lc + +include ../../Makefile.common diff --git a/Applications/Welcome/Makefile b/Applications/Welcome/Makefile index a8b377dd824..89e4636d8bf 100644 --- a/Applications/Welcome/Makefile +++ b/Applications/Welcome/Makefile @@ -1,14 +1,14 @@ -include ../../Makefile.common - OBJS = \ main.o \ TextWidget.o \ background.png.o -APP = Welcome +PROGRAM = Welcome + +LDFLAGS = -lgui -ldraw -lipc -lcore -lc .SUFFIXES: .png %.png.o: %.png @echo "LINK $<"; $(LINK) --relocatable --format binary --output $@ $< -include ../Makefile.common +include ../../Makefile.common diff --git a/Demos/Fire/Makefile b/Demos/Fire/Makefile index 5859bb36095..bae234fe12d 100644 --- a/Demos/Fire/Makefile +++ b/Demos/Fire/Makefile @@ -1,22 +1,8 @@ -include ../../Makefile.common - OBJS = \ Fire.o -APP = Fire +PROGRAM = Fire -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/Demos/HelloWorld/Makefile b/Demos/HelloWorld/Makefile index d2ca89ebfbb..d4bdac2e7ed 100644 --- a/Demos/HelloWorld/Makefile +++ b/Demos/HelloWorld/Makefile @@ -1,22 +1,8 @@ -include ../../Makefile.common - OBJS = \ main.o -APP = HelloWorld +PROGRAM = HelloWorld -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/Demos/HelloWorld2/Makefile b/Demos/HelloWorld2/Makefile index aa09fc27072..cc3904e8d96 100644 --- a/Demos/HelloWorld2/Makefile +++ b/Demos/HelloWorld2/Makefile @@ -1,27 +1,13 @@ -include ../../Makefile.common - OBJS = \ main.o -APP = HelloWorld2 +PROGRAM = HelloWorld2 -DEFINES += -DUSERLAND - -all: $(APP) +LDFLAGS = -lgui -ldraw -lipc -lcore -lc main.cpp: UI_HelloWorld2.h UI_HelloWorld2.h: HelloWorld2.frm ../../DevTools/FormCompiler/FormCompiler $< > $@ -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d - +include ../../Makefile.common diff --git a/Demos/Makefile b/Demos/Makefile new file mode 100644 index 00000000000..6a7b80e8952 --- /dev/null +++ b/Demos/Makefile @@ -0,0 +1,3 @@ +SUBDIRS := $(wildcard */.) + +include ../Makefile.subdir diff --git a/Demos/WidgetGallery/Makefile b/Demos/WidgetGallery/Makefile index 86f73384695..86d18e66e06 100644 --- a/Demos/WidgetGallery/Makefile +++ b/Demos/WidgetGallery/Makefile @@ -1,22 +1,8 @@ -include ../../Makefile.common - OBJS = \ main.o -APP = WidgetGallery +PROGRAM = WidgetGallery -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/DevTools/FormCompiler/Makefile b/DevTools/FormCompiler/Makefile index b4b7ac88eb7..9c8297b02eb 100644 --- a/DevTools/FormCompiler/Makefile +++ b/DevTools/FormCompiler/Makefile @@ -1,3 +1,5 @@ +HOST_CXX = 1 + PROGRAM = FormCompiler OBJS = \ @@ -19,15 +21,4 @@ OBJS = \ ../../Libraries/LibCore/CNotifier.o \ ../../Libraries/LibCore/CEventLoop.o -all: $(PROGRAM) - -CXXFLAGS = -std=c++17 -Wall -Wextra - -%.o: %.cpp - $(PRE_CXX) $(CXX) $(CXXFLAGS) -I../ -I../../ -I../../Libraries/ -o $@ -c $< - -$(PROGRAM): $(OBJS) - $(CXX) $(LDFLAGS) -I../ -I../../ -I../../Libraries/ -o $(PROGRAM) $(OBJS) - -clean: - rm -f $(PROGRAM) $(OBJS) +include ../../Makefile.common diff --git a/DevTools/HackStudio/Makefile b/DevTools/HackStudio/Makefile index b34672084c0..582332f226c 100644 --- a/DevTools/HackStudio/Makefile +++ b/DevTools/HackStudio/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ Project.o \ ProjectFile.o \ @@ -18,20 +16,8 @@ OBJS = \ WidgetTreeModel.o \ main.o -APP = HackStudio +PROGRAM = HackStudio -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lvt -lhtml -lprotocol -lipc -lmarkdown -lgui -ldraw -lthread -lpthread -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lvt -lhtml -lprotocol -lipc -lmarkdown -lgui -ldraw -lthread -lpthread -lcore -lc +include ../../Makefile.common diff --git a/DevTools/IPCCompiler/Makefile b/DevTools/IPCCompiler/Makefile index 089b75497a1..1cc65ded59f 100644 --- a/DevTools/IPCCompiler/Makefile +++ b/DevTools/IPCCompiler/Makefile @@ -1,3 +1,5 @@ +HOST_CXX = 1 + PROGRAM = IPCCompiler OBJS = \ @@ -19,15 +21,4 @@ OBJS = \ ../../Libraries/LibCore/CLocalServer.o \ ../../Libraries/LibCore/CEventLoop.o -all: $(PROGRAM) - -CXXFLAGS = -std=c++17 -Wall -Wextra -ggdb3 - -%.o: %.cpp - $(PRE_CXX) $(CXX) $(CXXFLAGS) -I../ -I../../ -I../../Libraries/ -o $@ -c $< - -$(PROGRAM): $(OBJS) - $(CXX) $(LDFLAGS) -I../ -I../../ -I../../Libraries/ -o $(PROGRAM) $(OBJS) - -clean: - rm -f $(PROGRAM) $(OBJS) +include ../../Makefile.common diff --git a/DevTools/Inspector/Makefile b/DevTools/Inspector/Makefile index 2430dcb4ddb..09cb351a20a 100644 --- a/DevTools/Inspector/Makefile +++ b/DevTools/Inspector/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ RemoteObjectGraphModel.o \ RemoteObjectPropertyModel.o \ @@ -7,20 +5,8 @@ OBJS = \ RemoteObject.o \ main.o -APP = Inspector +PROGRAM = Inspector -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/DevTools/Makefile b/DevTools/Makefile new file mode 100644 index 00000000000..6a7b80e8952 --- /dev/null +++ b/DevTools/Makefile @@ -0,0 +1,3 @@ +SUBDIRS := $(wildcard */.) + +include ../Makefile.subdir diff --git a/DevTools/ProfileViewer/Makefile b/DevTools/ProfileViewer/Makefile index 3c8c334c011..d72632a549d 100644 --- a/DevTools/ProfileViewer/Makefile +++ b/DevTools/ProfileViewer/Makefile @@ -1,25 +1,11 @@ -include ../../Makefile.common - OBJS = \ Profile.o \ ProfileModel.o \ ProfileTimelineWidget.o \ main.o -APP = ProfileViewer +PROGRAM = ProfileViewer -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/DevTools/VisualBuilder/Makefile b/DevTools/VisualBuilder/Makefile index 5fbb5492c1f..289c6167b17 100644 --- a/DevTools/VisualBuilder/Makefile +++ b/DevTools/VisualBuilder/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ VBForm.o \ VBWidget.o \ @@ -9,20 +7,8 @@ OBJS = \ VBPropertiesWindow.o \ main.o -APP = VisualBuilder +PROGRAM = VisualBuilder -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/Games/Makefile b/Games/Makefile new file mode 100644 index 00000000000..6a7b80e8952 --- /dev/null +++ b/Games/Makefile @@ -0,0 +1,3 @@ +SUBDIRS := $(wildcard */.) + +include ../Makefile.subdir diff --git a/Games/Minesweeper/Makefile b/Games/Minesweeper/Makefile index 396deec731c..ab28043822f 100644 --- a/Games/Minesweeper/Makefile +++ b/Games/Minesweeper/Makefile @@ -1,23 +1,9 @@ -include ../../Makefile.common - OBJS = \ Field.o \ main.o -APP = Minesweeper +PROGRAM = Minesweeper -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/Games/Snake/Makefile b/Games/Snake/Makefile index fea7faf3324..f579637e4f2 100644 --- a/Games/Snake/Makefile +++ b/Games/Snake/Makefile @@ -1,23 +1,9 @@ -include ../../Makefile.common - OBJS = \ SnakeGame.o \ main.o -APP = Snake +PROGRAM = Snake -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -ldraw -lipc -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lgui -ldraw -lipc -lcore -lc +include ../../Makefile.common diff --git a/Kernel/Makefile b/Kernel/Makefile index 877c37da306..d9b15fc87d9 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -1,6 +1,4 @@ -include ../Makefile.common - -CXX_OBJS = \ +OBJS = \ ../AK/FileSystemPath.o \ ../AK/JsonParser.o \ ../AK/JsonValue.o \ @@ -102,34 +100,32 @@ CXX_OBJS = \ init.o \ kprintf.o +OBJ_SUFFIX = .kernel + MODULE_OBJS = TestModule.o -OBJS = $(CXX_OBJS) Arch/i386/Boot/boot.ao +EXTRA_OBJS = Arch/i386/Boot/boot.ao + +KERNEL = 1 + +PROGRAM = kernel -KERNEL = kernel CXXFLAGS += -ffreestanding -mno-80387 -mno-mmx -mno-sse -mno-sse2 -fno-asynchronous-unwind-tables CXXFLAGS += -nostdlib -nostdinc -nostdinc++ CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/ CXXFLAGS += -I../Toolchain/Local/i686-pc-serenity/include/c++/9.2.0/i686-pc-serenity/ -DEFINES += -DKERNEL -LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib +LDFLAGS += -Ttext 0x100000 -Wl,-T linker.ld -nostdlib -lgcc -lstdc++ -all: $(KERNEL) $(MODULE_OBJS) kernel.map +all: $(PROGRAM) $(MODULE_OBJS) kernel.map kernel.map: kernel - @echo "MKMAP $@"; sh mkmap.sh + @echo "MKMAP $@" + $(QUIET) sh mkmap.sh -$(KERNEL): $(OBJS) - @echo "LD $@"; $(LD) $(LDFLAGS) -o $@ $(OBJS) -lgcc -lstdc++ +EXTRA_CLEAN += kernel.map -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - -%.ao: %.S - @echo "AS $@"; $(AS) -o $@ $< - --include $(CXX_OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(KERNEL) $(OBJS) *.d +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/Kernel/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/Kernel/ +include ../Makefile.common diff --git a/Kernel/install.sh b/Kernel/install.sh deleted file mode 100755 index 31e02cc7e65..00000000000 --- a/Kernel/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -mkdir -p ../Root/usr/include/Kernel/ -cp ./*.h ../Root/usr/include/Kernel/ diff --git a/Libraries/LibAudio/Makefile b/Libraries/LibAudio/Makefile index de136882588..aad4b7122d3 100644 --- a/Libraries/LibAudio/Makefile +++ b/Libraries/LibAudio/Makefile @@ -1,21 +1,12 @@ -include ../../Makefile.common - OBJS = \ AClientConnection.o \ AWavLoader.o LIBRARY = libaudio.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibAudio/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/LibAudio/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibAudio/install.sh b/Libraries/LibAudio/install.sh deleted file mode 100755 index 2cc86acbed8..00000000000 --- a/Libraries/LibAudio/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibAudio/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/LibAudio/ -cp libaudio.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibC/Makefile b/Libraries/LibC/Makefile index 391984ddca3..23d9886e616 100644 --- a/Libraries/LibC/Makefile +++ b/Libraries/LibC/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - AK_OBJS = \ ../../AK/StringImpl.o \ ../../AK/String.o \ @@ -57,30 +55,37 @@ LIBC_OBJS = \ serenity.o \ syslog.o -ASM_OBJS = setjmp.ao crti.ao crtn.ao +OBJS = $(AK_OBJS) $(LIBC_OBJS) -CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS) +EXTRA_OBJS = setjmp.ao crti.ao crtn.ao + +.PHONY: startfiles +startfiles: $(EXTRA_OBJS) + $(QUIET) cp crti.ao crti.o + $(QUIET) cp crtn.ao crtn.o + +EXTRA_CLEAN = crt0.d + +DEFINES = -DSERENITY_LIBC_BUILD LIBRARY = libc.a -DEFINES += -DUSERLAND -DSERENITY_LIBC_BUILD all: $(LIBRARY) startfiles -startfiles: $(ASM_OBJS) - @echo "CXX crt0.o"; $(CXX) $(CXXFLAGS) -o crt0.o -c crt0.cpp - cp crti.ao crti.o - cp crtn.ao crtn.o +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/sys/ + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/bits/ + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/netinet/ + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/arpa/ + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/lib/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/ + cp sys/*.h $(SERENITY_BASE_DIR)/Root/usr/include/sys/ + cp bits/*.h $(SERENITY_BASE_DIR)/Root/usr/include/bits/ + cp arpa/*.h $(SERENITY_BASE_DIR)/Root/usr/include/arpa/ + cp netinet/*.h $(SERENITY_BASE_DIR)/Root/usr/include/netinet/ + cp libc.a $(SERENITY_BASE_DIR)/Root/usr/lib/ + cp crt0.o $(SERENITY_BASE_DIR)/Root/usr/lib/ + cp crti.ao $(SERENITY_BASE_DIR)/Root/usr/lib/crti.o + cp crtn.ao $(SERENITY_BASE_DIR)/Root/usr/lib/crtn.o -$(LIBRARY): $(CPP_OBJS) $(ASM_OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(CPP_OBJS) $(ASM_OBJS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - -%.ao: %.S - @echo "AS $@"; $(AS) -o $@ $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(CPP_OBJS) $(ASM_OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibC/install.sh b/Libraries/LibC/install.sh deleted file mode 100755 index cd28e108540..00000000000 --- a/Libraries/LibC/install.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/sys/ -mkdir -p $SERENITY_ROOT/Root/usr/include/bits/ -mkdir -p $SERENITY_ROOT/Root/usr/include/netinet/ -mkdir -p $SERENITY_ROOT/Root/usr/include/arpa/ -mkdir -p $SERENITY_ROOT/Root/usr/lib/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/ -cp sys/*.h $SERENITY_ROOT/Root/usr/include/sys/ -cp bits/*.h $SERENITY_ROOT/Root/usr/include/bits/ -cp arpa/*.h $SERENITY_ROOT/Root/usr/include/arpa/ -cp netinet/*.h $SERENITY_ROOT/Root/usr/include/netinet/ -cp libc.a $SERENITY_ROOT/Root/usr/lib/ -cp crt0.o $SERENITY_ROOT/Root/usr/lib/ -cp crti.ao $SERENITY_ROOT/Root/usr/lib/crti.o -cp crtn.ao $SERENITY_ROOT/Root/usr/lib/crtn.o diff --git a/Libraries/LibCore/Makefile b/Libraries/LibCore/Makefile index c9f25fadef1..b052d19a085 100644 --- a/Libraries/LibCore/Makefile +++ b/Libraries/LibCore/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ CArgsParser.o \ CIODevice.o \ @@ -27,17 +25,10 @@ OBJS = \ CGzip.o LIBRARY = libcore.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibCore/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/LibCore/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibCore/install.sh b/Libraries/LibCore/install.sh deleted file mode 100755 index f9097615cb3..00000000000 --- a/Libraries/LibCore/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibCore/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/LibCore/ -cp libcore.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibDraw/Makefile b/Libraries/LibDraw/Makefile index dc2952ba926..8923d22f9c6 100644 --- a/Libraries/LibDraw/Makefile +++ b/Libraries/LibDraw/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ CharacterBitmap.o \ Color.o \ @@ -15,17 +13,10 @@ OBJS = \ Emoji.o LIBRARY = libdraw.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibDraw/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/LibDraw/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibDraw/install.sh b/Libraries/LibDraw/install.sh deleted file mode 100755 index 76354671fe3..00000000000 --- a/Libraries/LibDraw/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibDraw/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/LibDraw/ -cp libdraw.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibELF/Makefile b/Libraries/LibELF/Makefile new file mode 100644 index 00000000000..720752f1eb8 --- /dev/null +++ b/Libraries/LibELF/Makefile @@ -0,0 +1 @@ +include ../../Makefile.common diff --git a/Libraries/LibGUI/Makefile b/Libraries/LibGUI/Makefile index 5c72b0c0053..cc54c54b110 100644 --- a/Libraries/LibGUI/Makefile +++ b/Libraries/LibGUI/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ GPainter.o \ GButton.o \ @@ -64,17 +62,10 @@ OBJS = \ GWindow.o LIBRARY = libgui.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibGUI/ + cp ./*.h $(SERENITY_BASE_DIR)/Root/usr/include/LibGUI/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibGUI/install.sh b/Libraries/LibGUI/install.sh deleted file mode 100755 index d55a120bf9a..00000000000 --- a/Libraries/LibGUI/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibGUI/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/LibGUI/ -cp libgui.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile index 7e4bc8d3d32..2fbac0c056f 100644 --- a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile +++ b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile @@ -1,33 +1,24 @@ +HOST_CXX = 1 + PROGRAM = Generate_CSS_PropertyID_cpp OBJS = \ Generate_CSS_PropertyID_cpp.o \ - $(SERENITY_ROOT)/AK/String.o \ - $(SERENITY_ROOT)/AK/StringImpl.o \ - $(SERENITY_ROOT)/AK/StringBuilder.o \ - $(SERENITY_ROOT)/AK/StringView.o \ - $(SERENITY_ROOT)/AK/JsonValue.o \ - $(SERENITY_ROOT)/AK/JsonParser.o \ - $(SERENITY_ROOT)/AK/LogStream.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CIODevice.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CFile.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CObject.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CEvent.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CSocket.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CLocalSocket.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CNotifier.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CLocalServer.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CEventLoop.o + ../../../../AK/String.o \ + ../../../../AK/StringImpl.o \ + ../../../../AK/StringBuilder.o \ + ../../../../AK/StringView.o \ + ../../../../AK/JsonValue.o \ + ../../../../AK/JsonParser.o \ + ../../../../AK/LogStream.o \ + ../../../../Libraries/LibCore/CIODevice.o \ + ../../../../Libraries/LibCore/CFile.o \ + ../../../../Libraries/LibCore/CObject.o \ + ../../../../Libraries/LibCore/CEvent.o \ + ../../../../Libraries/LibCore/CSocket.o \ + ../../../../Libraries/LibCore/CLocalSocket.o \ + ../../../../Libraries/LibCore/CNotifier.o \ + ../../../../Libraries/LibCore/CLocalServer.o \ + ../../../../Libraries/LibCore/CEventLoop.o -all: $(PROGRAM) - -CXXFLAGS = -std=c++17 -Wall -Wextra - -%.o: %.cpp - $(PRE_CXX) $(CXX) $(CXXFLAGS) -I../ -I$(SERENITY_ROOT)/ -I$(SERENITY_ROOT)/Libraries/ -o $@ -c $< - -$(PROGRAM): $(OBJS) - $(CXX) $(LDFLAGS) -I../ -I$(SERENITY_ROOT)/ -I$(SERENITY_ROOT)/Libraries/ -o $(PROGRAM) $(OBJS) - -clean: - rm -f $(PROGRAM) $(OBJS) +include ../../../../Makefile.common diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Makefile b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Makefile index 783256d9e92..aff0892a8d8 100644 --- a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Makefile +++ b/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Makefile @@ -1,33 +1,24 @@ +HOST_CXX = 1 + PROGRAM = Generate_CSS_PropertyID_h OBJS = \ Generate_CSS_PropertyID_h.o \ - $(SERENITY_ROOT)/AK/String.o \ - $(SERENITY_ROOT)/AK/StringImpl.o \ - $(SERENITY_ROOT)/AK/StringBuilder.o \ - $(SERENITY_ROOT)/AK/StringView.o \ - $(SERENITY_ROOT)/AK/JsonValue.o \ - $(SERENITY_ROOT)/AK/JsonParser.o \ - $(SERENITY_ROOT)/AK/LogStream.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CIODevice.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CFile.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CObject.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CEvent.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CSocket.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CLocalSocket.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CNotifier.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CLocalServer.o \ - $(SERENITY_ROOT)/Libraries/LibCore/CEventLoop.o + ../../../../AK/String.o \ + ../../../../AK/StringImpl.o \ + ../../../../AK/StringBuilder.o \ + ../../../../AK/StringView.o \ + ../../../../AK/JsonValue.o \ + ../../../../AK/JsonParser.o \ + ../../../../AK/LogStream.o \ + ../../../../Libraries/LibCore/CIODevice.o \ + ../../../../Libraries/LibCore/CFile.o \ + ../../../../Libraries/LibCore/CObject.o \ + ../../../../Libraries/LibCore/CEvent.o \ + ../../../../Libraries/LibCore/CSocket.o \ + ../../../../Libraries/LibCore/CLocalSocket.o \ + ../../../../Libraries/LibCore/CNotifier.o \ + ../../../../Libraries/LibCore/CLocalServer.o \ + ../../../../Libraries/LibCore/CEventLoop.o -all: $(PROGRAM) - -CXXFLAGS = -std=c++17 -Wall -Wextra - -%.o: %.cpp - $(PRE_CXX) $(CXX) $(CXXFLAGS) -I../ -I$(SERENITY_ROOT)/ -I$(SERENITY_ROOT)/Libraries/ -o $@ -c $< - -$(PROGRAM): $(OBJS) - $(CXX) $(LDFLAGS) -I../ -I$(SERENITY_ROOT)/ -I$(SERENITY_ROOT)/Libraries/ -o $(PROGRAM) $(OBJS) - -clean: - rm -f $(PROGRAM) $(OBJS) +include ../../../../Makefile.common diff --git a/Libraries/LibHTML/Makefile b/Libraries/LibHTML/Makefile index 4090c7f9acf..c0a1672c0c3 100644 --- a/Libraries/LibHTML/Makefile +++ b/Libraries/LibHTML/Makefile @@ -1,9 +1,3 @@ -include ../../Makefile.common - -LIBRARY = libhtml.a - -all: $(LIBRARY) - LIBHTML_OBJS = \ CSS/DefaultStyleSheetSource.o \ CSS/PropertyID.o \ @@ -68,33 +62,32 @@ LIBHTML_OBJS = \ Parser/HTMLParser.o \ ResourceLoader.o -GENERATED_SOURCES = \ +EXTRA_SOURCES = \ CSS/DefaultStyleSheetSource.cpp \ CSS/PropertyID.h \ 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 + @echo "GENERATE $@" + $(QUIET) CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h $< > $@ + +CSS/PropertyID.cpp: CSS/Properties.json CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp + @echo "GENERATE $@" + $(QUIET) CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp $< > $@ + OBJS = $(EXTRA_OBJS) $(LIBHTML_OBJS) LIBRARY = libhtml.a -DEFINES += -DUSERLAND -CSS/DefaultStyleSheetSource.cpp: CSS/Default.css Scripts/GenerateStyleSheetSource.sh - @echo "GENERATE $@"; Scripts/GenerateStyleSheetSource.sh default_stylesheet_source $< > $@ - -CSS/PropertyID.h: CSS/Properties.json CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp - @echo "GENERATE $@"; CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h $< > $@ - -CSS/PropertyID.cpp: CSS/Properties.json CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp - @echo "GENERATE $@"; CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp $< > $@ - -%.o: %.cpp $(GENERATED_SOURCES) - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d $(GENERATED_SOURCES) - -$(LIBRARY): $(GENERATED_SOURCES) $(LIBHTML_OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(LIBHTML_OBJS) +install: + for dir in . Parser DOM CSS Layout; do \ + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibHTML/$$dir; \ + cp $$dir/*.h $(SERENITY_BASE_DIR)/Root/usr/include/LibHTML/$$dir/; \ + done + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ +include ../../Makefile.common diff --git a/Libraries/LibHTML/install.sh b/Libraries/LibHTML/install.sh deleted file mode 100755 index 11a80fcdde3..00000000000 --- a/Libraries/LibHTML/install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -for dir in . Parser DOM CSS Layout; do - mkdir -p $SERENITY_ROOT/Root/usr/include/LibHTML/$dir - cp $dir/*.h $SERENITY_ROOT/Root/usr/include/LibHTML/$dir/ -done - -cp libhtml.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibIPC/Makefile b/Libraries/LibIPC/Makefile index c7bc2904dc9..2f1de2f7954 100644 --- a/Libraries/LibIPC/Makefile +++ b/Libraries/LibIPC/Makefile @@ -1,21 +1,12 @@ -include ../../Makefile.common - OBJS = \ IEndpoint.o \ IMessage.o LIBRARY = libipc.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibIPC/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/LibIPC/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibIPC/install.sh b/Libraries/LibIPC/install.sh deleted file mode 100755 index ffbb34199c9..00000000000 --- a/Libraries/LibIPC/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibIPC/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/LibIPC/ -cp libipc.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibM/Makefile b/Libraries/LibM/Makefile index 983f8d1a691..b6c619b47d8 100644 --- a/Libraries/LibM/Makefile +++ b/Libraries/LibM/Makefile @@ -1,19 +1,11 @@ -include ../../Makefile.common - OBJS = math.o LIBRARY = libm.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/sys/ + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/lib/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibM/install.sh b/Libraries/LibM/install.sh deleted file mode 100755 index 827d31e385c..00000000000 --- a/Libraries/LibM/install.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/sys/ -mkdir -p $SERENITY_ROOT/Root/usr/lib/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/ -cp libm.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibMarkdown/Makefile b/Libraries/LibMarkdown/Makefile index 295fc19cdb7..7828776bd4e 100644 --- a/Libraries/LibMarkdown/Makefile +++ b/Libraries/LibMarkdown/Makefile @@ -1,25 +1,16 @@ -include ../../Makefile.common - OBJS = \ MDDocument.o \ - MDParagraph.o \ - MDHeading.o \ - MDCodeBlock.o \ - MDList.o \ - MDText.o + MDParagraph.o \ + MDHeading.o \ + MDCodeBlock.o \ + MDList.o \ + MDText.o LIBRARY = libmarkdown.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibMarkdown/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/LibMarkdown/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibMarkdown/install.sh b/Libraries/LibMarkdown/install.sh deleted file mode 100755 index 0f40a596759..00000000000 --- a/Libraries/LibMarkdown/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibMarkdown/ -cp *.h $SERENITY_ROOT/Root/usr/include/LibMarkdown/ -cp libmarkdown.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibPCIDB/Makefile b/Libraries/LibPCIDB/Makefile index 990099fa010..9f8c27f86bf 100644 --- a/Libraries/LibPCIDB/Makefile +++ b/Libraries/LibPCIDB/Makefile @@ -1,20 +1,11 @@ -include ../../Makefile.common - OBJS = \ Database.o LIBRARY = libpcidb.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibPCIDB/ + cp ./*.h $(SERENITY_BASE_DIR)/Root/usr/include/LibPCIDB/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibPCIDB/install.sh b/Libraries/LibPCIDB/install.sh deleted file mode 100755 index da4f78a4aa5..00000000000 --- a/Libraries/LibPCIDB/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibPCIDB/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/LibPCIDB/ -cp libpcidb.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibProtocol/Makefile b/Libraries/LibProtocol/Makefile index 0f34357db9b..b734a6e440a 100644 --- a/Libraries/LibProtocol/Makefile +++ b/Libraries/LibProtocol/Makefile @@ -1,21 +1,7 @@ -include ../../Makefile.common - OBJS = \ Download.o \ Client.o LIBRARY = libprotocol.a -DEFINES += -DUSERLAND -all: $(LIBRARY) - -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibPthread/Makefile b/Libraries/LibPthread/Makefile index 993ee2cdb99..e004c952723 100644 --- a/Libraries/LibPthread/Makefile +++ b/Libraries/LibPthread/Makefile @@ -1,19 +1,10 @@ -include ../../Makefile.common - OBJS = pthread.o LIBRARY = libpthread.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/lib/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibPthread/install.sh b/Libraries/LibPthread/install.sh deleted file mode 100755 index 4a7d00c6d1b..00000000000 --- a/Libraries/LibPthread/install.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/sys/ -mkdir -p $SERENITY_ROOT/Root/usr/lib/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/ -cp libpthread.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibThread/Makefile b/Libraries/LibThread/Makefile index bc548c208a7..57c2ae93b51 100644 --- a/Libraries/LibThread/Makefile +++ b/Libraries/LibThread/Makefile @@ -1,21 +1,12 @@ -include ../../Makefile.common - OBJS = \ Thread.o \ BackgroundAction.o LIBRARY = libthread.a -DEFINES += -DUSERLAND -all: $(LIBRARY) +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibThread/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/LibThread/ + cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/ -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/LibThread/install.sh b/Libraries/LibThread/install.sh deleted file mode 100755 index 3044ca1b63c..00000000000 --- a/Libraries/LibThread/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -set -e -SERENITY_ROOT=../../ - -mkdir -p $SERENITY_ROOT/Root/usr/include/LibThread/ -cp ./*.h $SERENITY_ROOT/Root/usr/include/LibThread/ -cp libthread.a $SERENITY_ROOT/Root/usr/lib/ diff --git a/Libraries/LibVT/Makefile b/Libraries/LibVT/Makefile index ba58d2af197..7aefbbb0780 100644 --- a/Libraries/LibVT/Makefile +++ b/Libraries/LibVT/Makefile @@ -1,21 +1,7 @@ -include ../../Makefile.common - OBJS = \ Terminal.o \ TerminalWidget.o LIBRARY = libvt.a -DEFINES += -DUSERLAND -all: $(LIBRARY) - -$(LIBRARY): $(OBJS) - @echo "LIB $@"; $(AR) rcs $@ $(OBJS) $(LIBS) - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(LIBRARY) $(OBJS) *.d +include ../../Makefile.common diff --git a/Libraries/Makefile b/Libraries/Makefile new file mode 100644 index 00000000000..6a7b80e8952 --- /dev/null +++ b/Libraries/Makefile @@ -0,0 +1,3 @@ +SUBDIRS := $(wildcard */.) + +include ../Makefile.subdir diff --git a/Makefile b/Makefile new file mode 100644 index 00000000000..f0f47c61421 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +# Build the host-side tools first, since they are needed to build some programs. +SUBDIRS = \ + DevTools/IPCCompiler \ + DevTools/FormCompiler \ + Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp \ + Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h + +# Build LibC, LibCore, LibIPC and LibThread before IPC servers, since they depend on them. +SUBDIRS += \ + Libraries/LibC \ + Libraries/LibCore \ + Libraries/LibDraw \ + Libraries/LibIPC \ + Libraries/LibThread \ + Libraries/LibPthread + +# Build IPC servers before their client code to ensure the IPC definitions are available. +SUBDIRS += \ + Servers/AudioServer \ + Servers/LookupServer \ + Servers/ProtocolServer \ + Libraries/LibAudio \ + Servers/WindowServer + +SUBDIRS += \ + AK + +SUBDIRS += \ + Libraries \ + Applications \ + DevTools \ + Servers \ + Shell \ + Userland \ + MenuApplets \ + Demos \ + Games \ + Kernel + +include Makefile.subdir + +.PHONY: test +test: + $(QUIET) $(MAKE) -C AK/Tests clean all clean diff --git a/Makefile.common b/Makefile.common index b75635604ec..893e8d6d79e 100644 --- a/Makefile.common +++ b/Makefile.common @@ -7,16 +7,14 @@ OPTIMIZATION_FLAGS = -Os MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) SERENITY_BASE_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) -INCLUDE_FLAGS = \ +INCLUDE_FLAGS += \ -I. \ + -I$(SERENITY_BASE_DIR)/DevTools \ -I$(SERENITY_BASE_DIR) \ -I$(SERENITY_BASE_DIR)/Libraries \ - -I$(SERENITY_BASE_DIR)/Libraries/LibC \ - -I$(SERENITY_BASE_DIR)/Servers \ - -I$(SERENITY_BASE_DIR)/Libraries/LibM \ - -I$(SERENITY_BASE_DIR)/Libraries/LibPthread + -I$(SERENITY_BASE_DIR)/Servers -LDFLAGS = \ +LDFLAGS += \ -L$(SERENITY_BASE_DIR)/Libraries/LibC \ -L$(SERENITY_BASE_DIR)/Libraries/LibPthread \ -L$(SERENITY_BASE_DIR)/Libraries/LibCore \ @@ -31,15 +29,82 @@ LDFLAGS = \ -L$(SERENITY_BASE_DIR)/Libraries/LibProtocol \ -L$(SERENITY_BASE_DIR)/Libraries/LibAudio -CLANG_FLAGS = -Wconsumed -m32 -ffreestanding -march=i686 +VERBOSE = 0 + +ifneq ($(HOST_CXX),) + CXX = g++ + AS = as + LINK = ld + OBJ_SUFFIX ?= .host +else + TOOLCHAIN_PATH = $(SERENITY_BASE_DIR)/Toolchain/Local/bin + CXX = $(PRE_CXX) $(TOOLCHAIN_PATH)/i686-pc-serenity-g++ + AS = $(TOOLCHAIN_PATH)/i686-pc-serenity-as + LINK = $(TOOLCHAIN_PATH)/i686-pc-serenity-ld + DEFINES += -DDEBUG + + INCLUDE_FLAGS += \ + -I$(SERENITY_BASE_DIR)/Libraries/LibC \ + -I$(SERENITY_BASE_DIR)/Libraries/LibM + + LDFLAGS += \ + -L$(SERENITY_BASE_DIR)/Libraries/LibC + + ifdef KERNEL + DEFINES += -DKERNEL + else + DEFINES += -DUSERLAND + endif + + OBJ_SUFFIX ?= +endif + +#CXX = clang $(CLANG_FLAGS) +#CLANG_FLAGS = -Wconsumed -m32 -ffreestanding -march=i686 + #SUGGEST_FLAGS = -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override #-Wsuggest-attribute=noreturn CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES) -#CXX = clang $(CLANG_FLAGS) -CXX = $(PRE_CXX) i686-pc-serenity-g++ -LD = i686-pc-serenity-g++ -AS = i686-pc-serenity-as -LINK = i686-pc-serenity-ld -DEFINES = -DSANITIZE_PTRS -DDEBUG -DGIT_COMMIT=\"`git rev-parse --short HEAD`\" -DGIT_BRANCH=\"`git rev-parse --abbrev-ref HEAD`\" -DGIT_CHANGES=\"`git diff-index --quiet HEAD -- && echo "tracked"|| echo "untracked"`\" +DEFINES += -DSANITIZE_PTRS -DGIT_COMMIT=\"`git rev-parse --short HEAD`\" -DGIT_BRANCH=\"`git rev-parse --abbrev-ref HEAD`\" -DGIT_CHANGES=\"`git diff-index --quiet HEAD -- && echo "tracked"|| echo "untracked"`\" IPCCOMPILER = $(SERENITY_BASE_DIR)/DevTools/IPCCompiler/IPCCompiler + +SUFFIXED_OBJS = $(patsubst %.o,%$(OBJ_SUFFIX).o,$(OBJS)) + +ifeq ($(VERBOSE),1) + QUIET = +else + QUIET = @ +endif + +-include $(SUFFIXED_OBJS:%.o=%.d) + +%$(OBJ_SUFFIX).o: %.cpp $(EXTRA_SOURCES) + @echo "CPP $@" + $(QUIET) $(CXX) $(CXXFLAGS) -o $@ -c $< + +%.ao: %.S + @echo "AS $@" + $(QUIET) $(AS) -o $@ $< + +$(PROGRAM): $(SUFFIXED_OBJS) $(EXTRA_OBJS) + @echo "LINK $(PROGRAM)" + $(QUIET) $(CXX) -o $(PROGRAM) $(EXTRA_OBJS) $(SUFFIXED_OBJS) $(LDFLAGS) + +$(LIBRARY): $(SUFFIXED_OBJS) $(EXTRA_OBJS) + @echo "LIB $@" + $(QUIET) $(AR) rcs $@ $(OBJS) $(EXTRA_OBJS) $(LIBS) + +.DEFAULT_GOAL := all + +all: $(PROGRAM) $(LIBRARY) + +EXTRA_CLEAN ?= + +clean: + @echo "CLEAN" + $(QUIET) rm -f $(PROGRAM) $(LIBRARY) $(SUFFIXED_OBJS) $(EXTRA_OBJS) *.d $(EXTRA_CLEAN) + +install: + +.PHONY: all clean diff --git a/Makefile.subdir b/Makefile.subdir new file mode 100644 index 00000000000..b4e86913f8c --- /dev/null +++ b/Makefile.subdir @@ -0,0 +1,17 @@ +subdirs: $(SUBDIRS) +$(SUBDIRS): + @$(MAKE) -C $@ + +all: $(subdirs) + +SUBDIRS_CLEAN = $(addsuffix .clean,$(SUBDIRS)) +clean: $(SUBDIRS_CLEAN) +$(SUBDIRS_CLEAN): %.clean: + @$(MAKE) -C $* clean + +SUBDIRS_INSTALL = $(addsuffix .install,$(SUBDIRS)) +install: $(SUBDIRS_INSTALL) +$(SUBDIRS_INSTALL): %.install: + @$(MAKE) -C $* install + +.PHONY: all clean install $(SUBDIRS) diff --git a/MenuApplets/Audio/Makefile b/MenuApplets/Audio/Makefile index cd0292e1ef7..5ccbf2c8b52 100755 --- a/MenuApplets/Audio/Makefile +++ b/MenuApplets/Audio/Makefile @@ -1,7 +1,7 @@ +OBJS = main.o + +PROGRAM = Audio.MenuApplet + +LDFLAGS = -laudio -lgui -lipc -ldraw -lthread -lpthread -lcore -lc + include ../../Makefile.common - -OBJS = main.o - -APP = Audio.MenuApplet - -include ../Makefile.common diff --git a/MenuApplets/CPUGraph/Makefile b/MenuApplets/CPUGraph/Makefile index b90b7103a53..79048639093 100755 --- a/MenuApplets/CPUGraph/Makefile +++ b/MenuApplets/CPUGraph/Makefile @@ -1,7 +1,7 @@ +OBJS = main.o + +PROGRAM = CPUGraph.MenuApplet + +LDFLAGS = -laudio -lgui -lipc -ldraw -lthread -lpthread -lcore -lc + include ../../Makefile.common - -OBJS = main.o - -APP = CPUGraph.MenuApplet - -include ../Makefile.common diff --git a/MenuApplets/Makefile b/MenuApplets/Makefile new file mode 100644 index 00000000000..6a7b80e8952 --- /dev/null +++ b/MenuApplets/Makefile @@ -0,0 +1,3 @@ +SUBDIRS := $(wildcard */.) + +include ../Makefile.subdir diff --git a/MenuApplets/Makefile.common b/MenuApplets/Makefile.common deleted file mode 100755 index 23628b6a21e..00000000000 --- a/MenuApplets/Makefile.common +++ /dev/null @@ -1,14 +0,0 @@ -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -laudio -lgui -lipc -ldraw -lthread -lpthread -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d diff --git a/Servers/AudioServer/Makefile b/Servers/AudioServer/Makefile index ebdf331a8b4..7ea0e7b484c 100644 --- a/Servers/AudioServer/Makefile +++ b/Servers/AudioServer/Makefile @@ -1,17 +1,14 @@ -include ../../Makefile.common - -AUDIOSERVER_OBJS = \ +OBJS = \ main.o \ ASMixer.o \ ASClientConnection.o \ ASEventLoop.o -APP = AudioServer -OBJS = $(AUDIOSERVER_OBJS) +PROGRAM = AudioServer -DEFINES += -DUSERLAND +LDFLAGS = -lc -lcore -lipc -lthread -lpthread -all: $(APP) +EXTRA_CLEAN = AudioServerEndpoint.h AudioClientEndpoint.h *.cpp: AudioServerEndpoint.h AudioClientEndpoint.h @@ -21,14 +18,8 @@ AudioServerEndpoint.h: AudioServer.ipc AudioClientEndpoint.h: AudioClient.ipc @echo "IPC $<"; $(IPCCOMPILER) $< > $@ -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore -lipc -lthread -lpthread - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d AudioServerEndpoint.h AudioClientEndpoint.h +install: + mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/AudioServer/ + cp *.h $(SERENITY_BASE_DIR)/Root/usr/include/AudioServer/ +include ../../Makefile.common diff --git a/Servers/AudioServer/install.sh b/Servers/AudioServer/install.sh deleted file mode 100755 index 0515e69f52a..00000000000 --- a/Servers/AudioServer/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -mkdir -p ../../Root/usr/include/AudioServer/ -cp ./*.h ../../Root/usr/include/AudioServer/ diff --git a/Servers/LookupServer/Makefile b/Servers/LookupServer/Makefile index 64adb2224a9..83ea532d5fe 100644 --- a/Servers/LookupServer/Makefile +++ b/Servers/LookupServer/Makefile @@ -1,24 +1,9 @@ -include ../../Makefile.common - -LOOKUPSERVER_OBJS = \ +OBJS = \ LookupServer.o \ main.o -APP = LookupServer -OBJS = $(LOOKUPSERVER_OBJS) +PROGRAM = LookupServer -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lc -lcore +include ../../Makefile.common diff --git a/Servers/Makefile b/Servers/Makefile new file mode 100644 index 00000000000..6a7b80e8952 --- /dev/null +++ b/Servers/Makefile @@ -0,0 +1,3 @@ +SUBDIRS := $(wildcard */.) + +include ../Makefile.subdir diff --git a/Servers/ProtocolServer/Makefile b/Servers/ProtocolServer/Makefile index ba66275513b..3d3148d2b00 100644 --- a/Servers/ProtocolServer/Makefile +++ b/Servers/ProtocolServer/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ PSClientConnection.o \ Protocol.o \ @@ -8,11 +6,9 @@ OBJS = \ HttpDownload.o \ main.o -APP = ProtocolServer +PROGRAM = ProtocolServer -DEFINES += -DUSERLAND - -all: $(APP) +LDFLAGS = -lc -lcore -lipc *.cpp: ProtocolServerEndpoint.h ProtocolClientEndpoint.h @@ -22,14 +18,4 @@ ProtocolServerEndpoint.h: ProtocolServer.ipc ProtocolClientEndpoint.h: ProtocolClient.ipc @echo "IPC $<"; $(IPCCOMPILER) $< > $@ -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore -lipc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d ProtocolClientEndpoint.h ProtocolServerEndpoint.h - +include ../../Makefile.common diff --git a/Servers/SystemServer/Makefile b/Servers/SystemServer/Makefile index 787fcd40a4f..6fcf27cd78a 100644 --- a/Servers/SystemServer/Makefile +++ b/Servers/SystemServer/Makefile @@ -1,24 +1,13 @@ -include ../../Makefile.common - -SYSTEMSERVER_OBJS = \ +OBJS = \ Service.o \ main.o -APP = SystemServer -OBJS = $(SYSTEMSERVER_OBJS) +PROGRAM = SystemServer -DEFINES += -DUSERLAND +LDFLAGS = -lcore -lc -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +install: + mkdir -p ../../Root/usr/include/SystemServer/ + cp *.h ../../Root/usr/include/SystemServer/ +include ../../Makefile.common diff --git a/Servers/SystemServer/install.sh b/Servers/SystemServer/install.sh deleted file mode 100755 index 63e656cf95e..00000000000 --- a/Servers/SystemServer/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -#mkdir -p ../../Root/usr/include/SystemServer/ -#cp *.h ../../Root/usr/include/SystemServer/ diff --git a/Servers/TTYServer/Makefile b/Servers/TTYServer/Makefile index b65d1a8e65f..d1eb798683e 100644 --- a/Servers/TTYServer/Makefile +++ b/Servers/TTYServer/Makefile @@ -1,23 +1,6 @@ -include ../../Makefile.common - -TTYSERVER_OBJS = \ +OBJS = \ main.o -APP = TTYServer -OBJS = $(TTYSERVER_OBJS) - -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +PROGRAM = TTYServer +include ../../Makefile.common diff --git a/Servers/TelnetServer/Makefile b/Servers/TelnetServer/Makefile index ab0373e7053..9606c548f4d 100644 --- a/Servers/TelnetServer/Makefile +++ b/Servers/TelnetServer/Makefile @@ -1,25 +1,10 @@ -include ../../Makefile.common - -ECHOSERVER_OBJS = \ +OBJS = \ Client.o \ Parser.o \ main.o -APP = TelnetServer -OBJS = $(ECHOSERVER_OBJS) +PROGRAM = TelnetServer -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -lcore - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lcore -lc +include ../../Makefile.common diff --git a/Servers/WindowServer/Makefile b/Servers/WindowServer/Makefile index 64ec798c670..6dcb3fec6a8 100644 --- a/Servers/WindowServer/Makefile +++ b/Servers/WindowServer/Makefile @@ -1,5 +1,3 @@ -include ../../Makefile.common - OBJS = \ WSEventLoop.o \ WSWindow.o \ @@ -18,11 +16,9 @@ OBJS = \ WSMenuManager.o \ main.o -APP = WindowServer +PROGRAM = WindowServer -DEFINES += -DUSERLAND - -all: $(APP) +LDFLAGS = -lc -ldraw -lcore -lthread -lpthread -lipc *.cpp: WindowServerEndpoint.h WindowClientEndpoint.h @@ -32,14 +28,10 @@ WindowServerEndpoint.h: WindowServer.ipc WindowClientEndpoint.h: WindowClient.ipc @echo "IPC $<"; $(IPCCOMPILER) $< > $@ -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lc -ldraw -lcore -lthread -lpthread -lipc +EXTRA_CLEAN = WindowServerEndpoint.h WindowClientEndpoint.h -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d WindowServerEndpoint.h WindowClientEndpoint.h +install: + mkdir -p ../../Root/usr/include/WindowServer/ + cp *.h ../../Root/usr/include/WindowServer/ +include ../../Makefile.common diff --git a/Servers/WindowServer/install.sh b/Servers/WindowServer/install.sh deleted file mode 100755 index 69f5176260e..00000000000 --- a/Servers/WindowServer/install.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -mkdir -p ../../Root/usr/include/WindowServer/ -cp ./*.h ../../Root/usr/include/WindowServer/ diff --git a/Shell/Makefile b/Shell/Makefile index 9cfea5c6941..8c45d96d6b5 100644 --- a/Shell/Makefile +++ b/Shell/Makefile @@ -1,24 +1,10 @@ -include ../Makefile.common - OBJS = \ Parser.o \ LineEditor.o \ main.o -APP = Shell +PROGRAM = Shell -DEFINES += -DUSERLAND - -all: $(APP) - -$(APP): $(OBJS) - $(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lcore -lc - -.cpp.o: - @echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) - -clean: - @echo "CLEAN"; rm -f $(APP) $(OBJS) *.d +LDFLAGS = -lcore -lc +include ../Makefile.common diff --git a/Userland/Makefile b/Userland/Makefile index b248af19bcc..053b6426cc4 100644 --- a/Userland/Makefile +++ b/Userland/Makefile @@ -1,28 +1,18 @@ -include ../Makefile.common - SRCS = $(wildcard *.cpp) OBJS = ${SRCS:.cpp=.o} APPS = ${SRCS:.cpp=} -DEFINES += -DUSERLAND +EXTRA_CLEAN = $(APPS) -.PHONY: all list clean +LDFLAGS = -lc -lhtml -lgui -ldraw -laudio -lipc -lthread -lcore -lpcidb -lmarkdown -lpthread -lprotocol -lipc all: $(OBJS) $(APPS) list: @echo $(APPS) -clean: - @echo "CLEAN" - @rm -f $(APPS) $(OBJS) *.d +$(APPS): %: %.o $(OBJS) + @echo "LINK $@" + $(QUIET) $(CXX) -o $@ $< $(LDFLAGS) -$(APPS) : % : %.o $(OBJS) - @echo "LD $@" - @$(LD) -o $@ $(LDFLAGS) $< -lc -lhtml -lgui -ldraw -laudio -lipc -lthread -lcore -lpcidb -lmarkdown -lpthread -lprotocol -lipc - -%.o: %.cpp - @echo "CXX $<" - @$(CXX) $(CXXFLAGS) -o $@ -c $< - --include $(OBJS:%.o=%.d) +include ../Makefile.common