From 30b3825f5c38f4921709251f9f635027690e9260 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 19 Feb 2020 01:22:51 -0800 Subject: [PATCH] libmesosphere: precompile mesosphere.hpp --- libraries/config/common.mk | 8 ++++++++ libraries/libmesosphere/Makefile | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libraries/config/common.mk b/libraries/config/common.mk index 7e1c84ab3..b05082292 100644 --- a/libraries/config/common.mk +++ b/libraries/config/common.mk @@ -87,3 +87,11 @@ endif ifneq ($(strip $(wildcard source/$(ATMOSPHERE_OS_DIR)/.*)),) SOURCES += source/$(ATMOSPHERE_OS_DIR) $(call DIR_WILDCARD,source/$(ATMOSPHERE_OS_DIR)) endif + +#--------------------------------------------------------------------------------- +# Rules for compiling pre-compiled headers +#--------------------------------------------------------------------------------- +%.gch: %.hpp + @echo $< + $(CXX) -w -x c++-header -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER) + @cp $@ $(<).gch diff --git a/libraries/libmesosphere/Makefile b/libraries/libmesosphere/Makefile index d8799a192..be6fb94d6 100644 --- a/libraries/libmesosphere/Makefile +++ b/libraries/libmesosphere/Makefile @@ -6,6 +6,8 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../config/common.mk #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- +PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp + DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Werror -fno-non-call-exceptions CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE) @@ -27,7 +29,7 @@ LIBDIRS := $(ATMOSPHERE_LIBRARIES_DIR)/libvapours ifneq ($(BUILD),$(notdir $(CURDIR))) #--------------------------------------------------------------------------------- -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) CFILES := $(foreach dir,$(SOURCES),$(filter-out $(notdir $(wildcard $(dir)/*.arch.*.c)) $(notdir $(wildcard $(dir)/*.board.*.c)) $(notdir $(wildcard $(dir)/*.os.*.c)), \ @@ -64,6 +66,7 @@ endif export OFILES_BIN := $(addsuffix .o,$(BINFILES)) export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.gch),$(notdir $(hdr))) export OFILES := $(OFILES_BIN) $(OFILES_SRC) export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) @@ -105,13 +108,15 @@ clean: #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) +DEPENDS := $(OFILES:.o=.d) $(GCH_FILES:.gch=.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT) : $(OFILES) +$(filter-out kern_svc_tables.o, $(OFILES)) : $(GCH_FILES) + $(OFILES_SRC) : $(HFILES_BIN) #---------------------------------------------------------------------------------