1*b63233d8Sdamjan############################################################### 2*b63233d8Sdamjan# 3*b63233d8Sdamjan# Licensed to the Apache Software Foundation (ASF) under one 4*b63233d8Sdamjan# or more contributor license agreements. See the NOTICE file 5*b63233d8Sdamjan# distributed with this work for additional information 6*b63233d8Sdamjan# regarding copyright ownership. The ASF licenses this file 7*b63233d8Sdamjan# to you under the Apache License, Version 2.0 (the 8*b63233d8Sdamjan# "License"); you may not use this file except in compliance 9*b63233d8Sdamjan# with the License. You may obtain a copy of the License at 10*b63233d8Sdamjan# 11*b63233d8Sdamjan# http://www.apache.org/licenses/LICENSE-2.0 12*b63233d8Sdamjan# 13*b63233d8Sdamjan# Unless required by applicable law or agreed to in writing, 14*b63233d8Sdamjan# software distributed under the License is distributed on an 15*b63233d8Sdamjan# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b63233d8Sdamjan# KIND, either express or implied. See the License for the 17*b63233d8Sdamjan# specific language governing permissions and limitations 18*b63233d8Sdamjan# under the License. 19*b63233d8Sdamjan# 20*b63233d8Sdamjan############################################################### 21*b63233d8Sdamjan 22*b63233d8Sdamjan 23*b63233d8Sdamjan 24*b63233d8Sdamjandefine gb_UnoApiTarget_autopackage_inc 25*b63233d8Sdamjan$$(eval $$(call gb_Package_Package,$(1)_inc,$$(patsubst %/empty,%,$$(call gb_UnoApiTarget_get_header_target,empty)))) 26*b63233d8Sdamjan$(foreach onefile,$(gb_UnoApiTarget_HPPFILES_$(1)), \ 27*b63233d8Sdamjan $$(eval $$(call gb_Package_add_file,$(1)_inc,$(patsubst $(1)/%,inc/$(1)/%,$(onefile)),$(onefile)))) 28*b63233d8Sdamjan 29*b63233d8Sdamjan$(call gb_Package_get_target,$(1)_inc) : $(call gb_UnoApiTarget_get_target,$(1)) 30*b63233d8Sdamjan 31*b63233d8Sdamjanendef 32*b63233d8Sdamjan 33*b63233d8Sdamjan# TODO: make multi repo safe 34*b63233d8Sdamjandefine gb_UnoApiTarget_autopackage_idl 35*b63233d8Sdamjan$$(eval $$(call gb_Package_Package,$(1)_idl,$(SRCDIR))) 36*b63233d8Sdamjan$(foreach onefile,$(gb_UnoApiTarget_IDLFILES_$(1)), \ 37*b63233d8Sdamjan $$(eval $$(call gb_Package_add_file,$(1)_idl,$(patsubst $(1)/%,idl/%,$(onefile)),$(onefile)))) 38*b63233d8Sdamjan 39*b63233d8Sdamjanendef 40*b63233d8Sdamjan 41*b63233d8Sdamjan$(call gb_UnoApiTarget_get_header_target,$(1))/% : $(call gb_UnoApiTarget_get_target,$(1)) 42*b63233d8Sdamjan mkdir -p $$(dir $$@) 43*b63233d8Sdamjan 44*b63233d8Sdamjandefine gb_UnoApiTarget_UnoApiTarget 45*b63233d8Sdamjan$$(eval $$(call gb_Module_register_target,$(call gb_UnoApiOutTarget_get_target,$(1)),$(call gb_UnoApiOutTarget_get_clean_target,$(1)))) 46*b63233d8Sdamjan$(call gb_UnoApiOutTarget_get_target,$(1)) : $(call gb_UnoApiTarget_get_target,$(1)) 47*b63233d8Sdamjan$(call gb_UnoApiOutTarget_get_clean_target,$(1)) : $(call gb_UnoApiTarget_get_clean_target,$(1)) 48*b63233d8Sdamjangb_UnoApiTarget_HPPFILES_$(1) := 49*b63233d8Sdamjangb_UnoApiTarget_IDLFILES_$(1) := 50*b63233d8Sdamjan 51*b63233d8Sdamjan.DELETE_ON_ERROR : \ 52*b63233d8Sdamjan $(call gb_UnoApiTarget_get_clean_target,$(1)) \ 53*b63233d8Sdamjan $(call gb_UnoApiTarget_get_target,$(1)) 54*b63233d8Sdamjan 55*b63233d8Sdamjanendef 56*b63233d8Sdamjan 57*b63233d8Sdamjandefine gb_UnoApiTarget_add_idlfiles 58*b63233d8Sdamjan$(foreach idl,$(2),$(call gb_UnoApiTarget_add_idlfile,$(1),$(idl))) 59*b63233d8Sdamjan 60*b63233d8Sdamjanendef 61*b63233d8Sdamjan 62*b63233d8Sdamjandefine gb_UnoApiTarget_add_idlfile 63*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiPartTarget_get_target,$(2).urd) 64*b63233d8Sdamjan$(call gb_UnoApiPartTarget_get_target,$(2).urd) : $(foreach repo,$(gb_REPOS),$(realpath $(repo)/$(2).idl)) 65*b63233d8Sdamjangb_UnoApiTarget_HPPFILES_$(1) += $(2).hdl 66*b63233d8Sdamjangb_UnoApiTarget_HPPFILES_$(1) += $(2).hpp 67*b63233d8Sdamjangb_UnoApiTarget_IDLFILES_$(1) += $(2).idl 68*b63233d8Sdamjan 69*b63233d8Sdamjan$(call gb_UnoApiTarget_get_header_target,)$(2).hpp :| $(call gb_UnoApiTarget_get_target,$(1)) 70*b63233d8Sdamjan$(call gb_UnoApiTarget_get_header_target,)$(2).hdl :| $(call gb_UnoApiTarget_get_target,$(1)) 71*b63233d8Sdamjan 72*b63233d8Sdamjanendef 73*b63233d8Sdamjan 74*b63233d8Sdamjandefine gb_UnoApiTarget_add_idlfiles_noheader 75*b63233d8Sdamjan$(foreach idl,$(2),$(call gb_UnoApiTarget_add_idlfile_noheader,$(1),$(idl))) 76*b63233d8Sdamjan 77*b63233d8Sdamjanendef 78*b63233d8Sdamjan 79*b63233d8Sdamjandefine gb_UnoApiTarget_add_idlfile_noheader 80*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiPartTarget_get_target,$(2).urd) 81*b63233d8Sdamjan$(call gb_UnoApiPartTarget_get_target,$(2).urd) : $(foreach repo,$(gb_REPOS),$(realpath $(repo)/$(2).idl)) 82*b63233d8Sdamjangb_UnoApiTarget_IDLFILES_$(1) += $(2).idl 83*b63233d8Sdamjan 84*b63233d8Sdamjanendef 85*b63233d8Sdamjan 86*b63233d8Sdamjandefine gb_UnoApiTarget_add_idlfiles_nohdl 87*b63233d8Sdamjan$(foreach idl,$(2),$(call gb_UnoApiTarget_add_idlfile_nohdl,$(1),$(idl))) 88*b63233d8Sdamjan 89*b63233d8Sdamjanendef 90*b63233d8Sdamjan 91*b63233d8Sdamjandefine gb_UnoApiTarget_add_idlfile_nohdl 92*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiPartTarget_get_target,$(2).urd) 93*b63233d8Sdamjan$(call gb_UnoApiPartTarget_get_target,$(2).urd) : $(foreach repo,$(gb_REPOS),$(realpath $(repo)/$(2).idl)) 94*b63233d8Sdamjangb_UnoApiTarget_HPPFILES_$(1) += $(2).hpp 95*b63233d8Sdamjangb_UnoApiTarget_IDLFILES_$(1) += $(2).idl 96*b63233d8Sdamjan 97*b63233d8Sdamjan$(call gb_UnoApiTarget_get_header_target,)$(2).hpp :| $(call gb_UnoApiTarget_get_target,$(1)) 98*b63233d8Sdamjan 99*b63233d8Sdamjanendef 100*b63233d8Sdamjan 101*b63233d8Sdamjandefine gb_UnoApiTarget_add_rdbfiles 102*b63233d8Sdamjan$(foreach rdb,$(2),$(call gb_UnoApiTarget_add_rdbfile,$(1),$(rdb))) 103*b63233d8Sdamjan 104*b63233d8Sdamjanendef 105*b63233d8Sdamjan 106*b63233d8Sdamjandefine gb_UnoApiTarget_add_rdbfile 107*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_DEPS += -X$(call gb_UnoApiOutTarget_get_target,$(2)) 108*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : \ 109*b63233d8Sdamjan $(call gb_UnoApiOutTarget_get_target,$(2)) \ 110*b63233d8Sdamjan $(call gb_Package_get_target,$(2)_idl) 111*b63233d8Sdamjan 112*b63233d8Sdamjanendef 113*b63233d8Sdamjan 114*b63233d8Sdamjandefine gb_UnoApiTarget_add_merge_rdbfiles 115*b63233d8Sdamjan$(foreach rdb,$(2),$(call gb_UnoApiTarget_add_merge_rdbfile,$(1),$(rdb))) 116*b63233d8Sdamjan 117*b63233d8Sdamjanendef 118*b63233d8Sdamjan 119*b63233d8Sdamjandefine gb_UnoApiTarget_add_merge_rdbfile 120*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_MERGE += $(call gb_UnoApiOutTarget_get_target,$(2)) 121*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : $(call gb_UnoApiOutTarget_get_target,$(2)) 122*b63233d8Sdamjan 123*b63233d8Sdamjanendef 124*b63233d8Sdamjan 125*b63233d8Sdamjan#UNOAPI_REFERENCE_$(1) := $(foreach repo,$(gb_REPOS),$(realpath $(repo)/$(strip $(2)).rdb)) 126*b63233d8Sdamjandefine gb_UnoApiTarget_add_reference_rdbfile 127*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : UNOAPI_REFERENCE := $(foreach repo,$(gb_REPOS),$(realpath $(repo)/$(strip $(2)).rdb)) 128*b63233d8Sdamjan 129*b63233d8Sdamjanendef 130*b63233d8Sdamjan 131*b63233d8Sdamjandefine gb_UnoApiTarget_set_include 132*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,$(1)) : INCLUDE := $(2) 133*b63233d8Sdamjan 134*b63233d8Sdamjanendef 135*b63233d8Sdamjan 136*b63233d8Sdamjan.PHONY : $(call gb_UnoApiOutTarget_get_clean_target,%) 137*b63233d8Sdamjan$(call gb_UnoApiOutTarget_get_clean_target,%) : 138*b63233d8Sdamjan $(call gb_Output_announce,$*,$(false),UNOAPI,1) 139*b63233d8Sdamjan -$(call gb_Helper_abbreviate_dirs,\ 140*b63233d8Sdamjan rm -f $(call gb_UnoApiOutTarget_get_target,$*)) 141*b63233d8Sdamjan 142*b63233d8Sdamjan.PHONY : $(call gb_UnoApiTarget_get_clean_target,%) 143*b63233d8Sdamjan$(call gb_UnoApiTarget_get_clean_target,%) : 144*b63233d8Sdamjan $(call gb_Output_announce,$*,$(false),UNOAPI,1) 145*b63233d8Sdamjan -$(call gb_Helper_abbreviate_dirs,\ 146*b63233d8Sdamjan rm -f $(call gb_UnoApiTarget_get_target,$*)) 147*b63233d8Sdamjan -rm -rf $(call gb_UnoApiTarget_get_header_target,$*)\ 148*b63233d8Sdamjan $(call gb_UnoApiPartTarget_get_target,$*) 149*b63233d8Sdamjan 150*b63233d8Sdamjan# idlc doesn't return error codes != 0 in case of an error, so 151*b63233d8Sdamjan# check self 152*b63233d8Sdamjandefine gb_UnoApiPartTarget__command 153*b63233d8Sdamjanmkdir -p $(dir $(1)) && \ 154*b63233d8Sdamjan mkdir -p $(gb_Helper_MISC) && \ 155*b63233d8Sdamjan RESPONSEFILE=`$(gb_MKTEMP)` && \ 156*b63233d8Sdamjan echo "$(call gb_Helper_convert_native,$(5) $(6) -O $(call gb_UnoApiPartTarget_get_target,$(2)) -verbose -C $(4))" > $${RESPONSEFILE} && \ 157*b63233d8Sdamjan $(gb_UnoApiTarget_IDLCCOMMAND) @$${RESPONSEFILE} > /dev/null && \ 158*b63233d8Sdamjan rm -f $${RESPONSEFILE} && \ 159*b63233d8Sdamjan test -f $(@) 160*b63233d8Sdamjan 161*b63233d8Sdamjanendef 162*b63233d8Sdamjan 163*b63233d8Sdamjan$(call gb_UnoApiPartTarget_get_target,%) : 164*b63233d8Sdamjan $(call gb_Output_announce,$*,$(true),IDL,2) 165*b63233d8Sdamjan $(call gb_UnoApiPartTarget__command,$@,$(dir $*),$<,$?,$(INCLUDE),$(DEFS)) 166*b63233d8Sdamjan 167*b63233d8Sdamjan 168*b63233d8Sdamjandefine gb_UnoApiTarget__command 169*b63233d8Sdamjan mkdir -p $(dir $(1)) && \ 170*b63233d8Sdamjan RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,$(call gb_Helper_convert_native,$(1) $(4) $(5))) && \ 171*b63233d8Sdamjan $(gb_UnoApiTarget_REGMERGECOMMAND) @$${RESPONSEFILE} && \ 172*b63233d8Sdamjan rm -f $${RESPONSEFILE} 173*b63233d8Sdamjan 174*b63233d8Sdamjanendef 175*b63233d8Sdamjan 176*b63233d8Sdamjandefine gb_UnoApiHeaderTarget__command 177*b63233d8Sdamjan$(call gb_Helper_abbreviate_dirs_native,\ 178*b63233d8Sdamjan mkdir -p $(dir $(1)) && \ 179*b63233d8Sdamjan mkdir -p $(gb_Helper_MISC) && \ 180*b63233d8Sdamjan RESPONSEFILE=`$(gb_MKTEMP)` && \ 181*b63233d8Sdamjan echo " -Gc -L -BUCR -O$(call gb_UnoApiTarget_get_header_target,$*) $(7) \ 182*b63233d8Sdamjan $(1) \ 183*b63233d8Sdamjan " > $${RESPONSEFILE} && \ 184*b63233d8Sdamjan $(gb_UnoApiTarget_CPPUMAKERCOMMAND) @$${RESPONSEFILE} && \ 185*b63233d8Sdamjan rm -f $${RESPONSEFILE}) 186*b63233d8Sdamjan 187*b63233d8Sdamjanendef 188*b63233d8Sdamjan 189*b63233d8Sdamjan# TODO: 190*b63233d8Sdamjan# - get idlc switch "-P" (generate .urd into package dir) 191*b63233d8Sdamjan# - generate dependencies for included idls 192*b63233d8Sdamjan# - empty $? in headertarget? 193*b63233d8Sdamjan 194*b63233d8Sdamjan$(call gb_UnoApiTarget_get_target,%): 195*b63233d8Sdamjan $(call gb_Output_announce,$*,$(true),RDB,3) 196*b63233d8Sdamjan $(if $(gb_UnoApiTarget_IDLFILES_$*),$(call gb_UnoApiTarget__command,$@,$*,$<,UCR,$(addprefix $(call gb_UnoApiPartTarget_get_target,),$(patsubst %.idl,%.urd,$(gb_UnoApiTarget_IDLFILES_$*))))) 197*b63233d8Sdamjan $(if $(UNOAPI_MERGE),$(call gb_UnoApiTarget__command,$@,$*,$<,/,$(UNOAPI_MERGE))) 198*b63233d8Sdamjan $(if $(UNOAPI_REFERENCE), \ 199*b63233d8Sdamjan $(call gb_Output_announce,$*,$(true),RDBCHEK,4) \ 200*b63233d8Sdamjan $(gb_UnoApiTarget_REGCOMPARECOMMAND) -f -t -r1 $(call gb_Helper_convert_native,$(UNOAPI_REFERENCE)) -r2 $(call gb_Helper_convert_native,$@)) 201*b63233d8Sdamjan $(if $(gb_UnoApiTarget_IDLFILES_$*), \ 202*b63233d8Sdamjan $(call gb_Output_announce,$*,$(true),HPP,4) \ 203*b63233d8Sdamjan $(call gb_UnoApiHeaderTarget__command,$@,$*,$<,$?,$(INCLUDE),$(DEFS),$(UNOAPI_DEPS))) 204*b63233d8Sdamjan 205*b63233d8Sdamjan# vim: set noet sw=4 ts=4: 206