1*cdf0e10cSrcweir#************************************************************************* 2*cdf0e10cSrcweir# 3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir# 5*cdf0e10cSrcweir# Copyright 2000, 2011 Oracle and/or its affiliates. 6*cdf0e10cSrcweir# 7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir# 9*cdf0e10cSrcweir# This file is part of OpenOffice.org. 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir# 15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir# 21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir# 26*cdf0e10cSrcweir#************************************************************************* 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir# Module class 30*cdf0e10cSrcweir 31*cdf0e10cSrcweirgb_Module_ALLMODULES := 32*cdf0e10cSrcweirgb_Module_MODULELOCATIONS := 33*cdf0e10cSrcweirgb_Module_TARGETSTACK := 34*cdf0e10cSrcweirgb_Module_CHECKTARGETSTACK := 35*cdf0e10cSrcweirgb_Module_SUBSEQUENTCHECKTARGETSTACK := 36*cdf0e10cSrcweirgb_Module_CLEANTARGETSTACK := 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir.PHONY : $(call gb_Module_get_clean_target,%) 39*cdf0e10cSrcweir$(call gb_Module_get_clean_target,%) : 40*cdf0e10cSrcweir $(call gb_Output_announce,$*,$(false),MOD,5) 41*cdf0e10cSrcweir $(call gb_Output_announce_title,module $* cleared.) 42*cdf0e10cSrcweir -$(call gb_Helper_abbreviate_dirs,\ 43*cdf0e10cSrcweir rm -f $(call gb_Module_get_target,$*) $(call gb_Module_get_check_target,$*) $(call gb_Module_get_subsequentcheck_target,$*)) 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir$(call gb_Module_get_check_target,%) : 46*cdf0e10cSrcweir $(call gb_Output_announce,$*,$(true),CHK,5) 47*cdf0e10cSrcweir $(call gb_Output_announce_title,module $* checks done.) 48*cdf0e10cSrcweir -$(call gb_Helper_abbreviate_dirs,\ 49*cdf0e10cSrcweir mkdir -p $(dir $@) && \ 50*cdf0e10cSrcweir touch $@) 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir$(call gb_Module_get_subsequentcheck_target,%) : 53*cdf0e10cSrcweir $(call gb_Output_announce,$*,$(true),SCK,5) 54*cdf0e10cSrcweir $(call gb_Output_announce_title,module $* subsequentchecks done.) 55*cdf0e10cSrcweir -$(call gb_Helper_abbreviate_dirs,\ 56*cdf0e10cSrcweir mkdir -p $(dir $@) && \ 57*cdf0e10cSrcweir touch $@) 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir$(call gb_Module_get_target,%) : 60*cdf0e10cSrcweir $(call gb_Output_announce,$*,$(true),MOD,5) 61*cdf0e10cSrcweir $(call gb_Output_announce_title,module $* done.) 62*cdf0e10cSrcweir -$(call gb_Helper_abbreviate_dirs,\ 63*cdf0e10cSrcweir mkdir -p $(dir $@) && \ 64*cdf0e10cSrcweir touch $@) 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir.PHONY : all allandcheck clean check subsequentcheck 67*cdf0e10cSrcweir.DEFAULT_GOAL := allandcheck 68*cdf0e10cSrcweir 69*cdf0e10cSrcweirallandcheck : all check 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir# compatibility with the old build system 72*cdf0e10cSrcweirifneq ($(strip $(OOO_SUBSEQUENT_TESTS)),) 73*cdf0e10cSrcweir.DEFAULT_GOAL := subsequentcheck 74*cdf0e10cSrcweirendif 75*cdf0e10cSrcweir 76*cdf0e10cSrcweirall : 77*cdf0e10cSrcweir $(call gb_Output_announce,top level modules: $(foreach module,$(filter-out deliverlog,$^),$(notdir $(module))),$(true),ALL,6) 78*cdf0e10cSrcweir $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),ALL,6) 79*cdf0e10cSrcweir $(call gb_Output_announce_title,all done.) 80*cdf0e10cSrcweir $(call gb_Output_announce_bell) 81*cdf0e10cSrcweir 82*cdf0e10cSrcweircheck : 83*cdf0e10cSrcweir $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),CHK,6) 84*cdf0e10cSrcweir $(call gb_Output_announce_title,all tests checked.) 85*cdf0e10cSrcweir $(call gb_Output_announce_bell) 86*cdf0e10cSrcweir 87*cdf0e10cSrcweirsubsequentcheck : all 88*cdf0e10cSrcweir $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),SCK,6) 89*cdf0e10cSrcweir $(call gb_Output_announce_title,all subsequent tests checked.) 90*cdf0e10cSrcweir $(call gb_Output_announce_bell) 91*cdf0e10cSrcweir 92*cdf0e10cSrcweirclean : 93*cdf0e10cSrcweir $(call gb_Output_announce,top level modules: $(foreach module,$^,$(notdir $(module))),$(false),ALL,6) 94*cdf0e10cSrcweir $(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(false),ALL,6) 95*cdf0e10cSrcweir $(call gb_Output_announce_title,all cleared.) 96*cdf0e10cSrcweir $(call gb_Output_announce_bell) 97*cdf0e10cSrcweir 98*cdf0e10cSrcweirdefine gb_Module_Module 99*cdf0e10cSrcweirgb_Module_ALLMODULES += $(1) 100*cdf0e10cSrcweirgb_Module_MODULELOCATIONS += $(1):$(dir $(realpath $(lastword $(MAKEFILE_LIST)))) 101*cdf0e10cSrcweirgb_Module_TARGETSTACK := $(call gb_Module_get_target,$(1)) $(gb_Module_TARGETSTACK) 102*cdf0e10cSrcweirgb_Module_CHECKTARGETSTACK := $(call gb_Module_get_check_target,$(1)) $(gb_Module_CHECKTARGETSTACK) 103*cdf0e10cSrcweirgb_Module_SUBSEQUENTCHECKTARGETSTACK := $(call gb_Module_get_subsequentcheck_target,$(1)) $(gb_Module_SUBSEQUENTCHECKTARGETSTACK) 104*cdf0e10cSrcweirgb_Module_CLEANTARGETSTACK := $(call gb_Module_get_clean_target,$(1)) $(gb_Module_CLEANTARGETSTACK) 105*cdf0e10cSrcweir 106*cdf0e10cSrcweirendef 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir# This is called inside the included file and pushes one target on each stack. 109*cdf0e10cSrcweir# This has to be called with full late evaluation ($$(eval $$(call ))) and 110*cdf0e10cSrcweir# should never be inlined ($(call )) as the calls defining it might be sourced 111*cdf0e10cSrcweir# before gb_Module. 112*cdf0e10cSrcweirdefine gb_Module_register_target 113*cdf0e10cSrcweirgb_Module_CURRENTTARGET := $(1) 114*cdf0e10cSrcweirgb_Module_CURRENTCLEANTARGET := $(2) 115*cdf0e10cSrcweir 116*cdf0e10cSrcweirendef 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir# Here we include the file (in it there will be a call to gb_Module_register_target) 119*cdf0e10cSrcweirdefine gb_Module__read_targetfile 120*cdf0e10cSrcweirgb_Module_CURRENTTARGET := 121*cdf0e10cSrcweirgb_Module_CURRENTCLEANTARGET := 122*cdf0e10cSrcweirinclude $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk 123*cdf0e10cSrcweirifneq ($$(words $$(gb_Module_CURRENTTARGET)) $$(words $$(gb_Module_CURRENTCLEANTARGET)),1 1) 124*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,No $(3) registered while reading $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))$(2).mk!)) 125*cdf0e10cSrcweirendif 126*cdf0e10cSrcweir 127*cdf0e10cSrcweirendef 128*cdf0e10cSrcweir 129*cdf0e10cSrcweirdefine gb_Module_add_target 130*cdf0e10cSrcweir$(call gb_Module__read_targetfile,$(1),$(2),target) 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir$(call gb_Module_get_target,$(1)) : $$(gb_Module_CURRENTTARGET) 133*cdf0e10cSrcweir$(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET) 134*cdf0e10cSrcweir 135*cdf0e10cSrcweirendef 136*cdf0e10cSrcweir 137*cdf0e10cSrcweirdefine gb_Module_add_check_target 138*cdf0e10cSrcweir$(call gb_Module__read_targetfile,$(1),$(2),check target) 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir$(call gb_Module_get_check_target,$(1)) : $$(gb_Module_CURRENTTARGET) 141*cdf0e10cSrcweir$(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET) 142*cdf0e10cSrcweir 143*cdf0e10cSrcweirendef 144*cdf0e10cSrcweir 145*cdf0e10cSrcweirdefine gb_Module_add_subsequentcheck_target 146*cdf0e10cSrcweir$(call gb_Module__read_targetfile,$(1),$(2),subsequentcheck target) 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir$(call gb_Module_get_subsequentcheck_target,$(1)) : $$(gb_Module_CURRENTTARGET) 149*cdf0e10cSrcweir$(call gb_Module_get_clean_target,$(1)) : $$(gb_Module_CURRENTCLEANTARGET) 150*cdf0e10cSrcweir 151*cdf0e10cSrcweirendef 152*cdf0e10cSrcweir 153*cdf0e10cSrcweirdefine gb_Module_add_moduledir 154*cdf0e10cSrcweirinclude $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Module_MODULELOCATIONS)))/$(2)/Module_$(2).mk 155*cdf0e10cSrcweir$(call gb_Module_get_target,$(1)) : $$(firstword $$(gb_Module_TARGETSTACK)) 156*cdf0e10cSrcweir$(call gb_Module_get_check_target,$(1)) : $$(firstword $$(gb_Module_CHECKTARGETSTACK)) 157*cdf0e10cSrcweir$(call gb_Module_get_subsequentcheck_target,$(1)) : $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)) 158*cdf0e10cSrcweir$(call gb_Module_get_clean_target,$(1)) : $$(firstword $$(gb_Module_CLEANTARGETSTACK)) 159*cdf0e10cSrcweirgb_Module_TARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_TARGETSTACK)),$$(gb_Module_TARGETSTACK)) 160*cdf0e10cSrcweirgb_Module_CHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CHECKTARGETSTACK)),$$(gb_Module_CHECKTARGETSTACK)) 161*cdf0e10cSrcweirgb_Module_SUBSEQUENTCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)) 162*cdf0e10cSrcweirgb_Module_CLEANTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CLEANTARGETSTACK)),$$(gb_Module_CLEANTARGETSTACK)) 163*cdf0e10cSrcweir 164*cdf0e10cSrcweirendef 165*cdf0e10cSrcweir 166*cdf0e10cSrcweirdefine gb_Module_add_targets 167*cdf0e10cSrcweir$(foreach target,$(2),$(call gb_Module_add_target,$(1),$(target))) 168*cdf0e10cSrcweir 169*cdf0e10cSrcweirendef 170*cdf0e10cSrcweir 171*cdf0e10cSrcweirdefine gb_Module_add_check_targets 172*cdf0e10cSrcweir$(foreach target,$(2),$(call gb_Module_add_check_target,$(1),$(target))) 173*cdf0e10cSrcweir 174*cdf0e10cSrcweirendef 175*cdf0e10cSrcweir 176*cdf0e10cSrcweirdefine gb_Module_add_subsequentcheck_targets 177*cdf0e10cSrcweir$(foreach target,$(2),$(call gb_Module_add_subsequentcheck_target,$(1),$(target))) 178*cdf0e10cSrcweir 179*cdf0e10cSrcweirendef 180*cdf0e10cSrcweir 181*cdf0e10cSrcweirdefine gb_Module_add_moduledirs 182*cdf0e10cSrcweir$(foreach target,$(2),$(call gb_Module_add_moduledir,$(1),$(target))) 183*cdf0e10cSrcweirendef 184*cdf0e10cSrcweir 185*cdf0e10cSrcweirdefine gb_Module_make_global_targets 186*cdf0e10cSrcweirifneq ($$(gb_Module_TARGETSTACK),) 187*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Corrupted module target stack!1)) 188*cdf0e10cSrcweirendif 189*cdf0e10cSrcweir 190*cdf0e10cSrcweirinclude $(1) 191*cdf0e10cSrcweir 192*cdf0e10cSrcweirall : $$(firstword $$(gb_Module_TARGETSTACK)) 193*cdf0e10cSrcweircheck : $$(firstword $$(gb_Module_CHECKTARGETSTACK)) 194*cdf0e10cSrcweirsubsequentcheck : $$(firstword $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)) 195*cdf0e10cSrcweirclean : $$(firstword $$(gb_Module_CLEANTARGETSTACK)) 196*cdf0e10cSrcweir 197*cdf0e10cSrcweirifneq ($$(words $$(gb_Module_TARGETSTACK)),1) 198*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Corrupted module target stack! $(gb_Module_TARGETSTACK))) 199*cdf0e10cSrcweirendif 200*cdf0e10cSrcweir 201*cdf0e10cSrcweirgb_Module_TARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_TARGETSTACK)),$$(gb_Module_TARGETSTACK)) 202*cdf0e10cSrcweirgb_Module_CHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CHECKTARGETSTACK)),$$(gb_Module_CHECKTARGETSTACK)) 203*cdf0e10cSrcweirgb_Module_SUBSEQUENTCHECKTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)) 204*cdf0e10cSrcweirgb_Module_CLEANTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CLEANTARGETSTACK)),$$(gb_Module_CLEANTARGETSTACK)) 205*cdf0e10cSrcweir 206*cdf0e10cSrcweirifneq ($$(and $$(gb_Module_TARGETSTACK),$$(gb_Module_CHECKTARGETSTACK),$$(gb_Module_SUBSEQUENTCHECKTARGETSTACK)),) 207*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,Corrupted module target stack!3)) 208*cdf0e10cSrcweirendif 209*cdf0e10cSrcweir 210*cdf0e10cSrcweirendef 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir# vim: set noet sw=4 ts=4: 213