xref: /aoo41x/main/solenv/gbuild/Helper.mk (revision cdf0e10c)
1*cdf0e10cSrcweir#*************************************************************************
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir# Copyright 2000, 2010 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*cdf0e10cSrcweirgb_Helper_NULLFILE := /dev/null
29*cdf0e10cSrcweir
30*cdf0e10cSrcweirgb_Helper_MISC := $(WORKDIR)/Misc
31*cdf0e10cSrcweir
32*cdf0e10cSrcweirifeq ($(JAVACOMPILER),)
33*cdf0e10cSrcweirJAVACOMPILER := javac
34*cdf0e10cSrcweirendif
35*cdf0e10cSrcweir
36*cdf0e10cSrcweirifeq ($(JAVAINTERPRETER),)
37*cdf0e10cSrcweirJAVAINTERPRETER := java
38*cdf0e10cSrcweirendif
39*cdf0e10cSrcweir
40*cdf0e10cSrcweir# general propose phony target
41*cdf0e10cSrcweirgb_Helper_PHONY := $(gb_Helper_MISC)/PHONY
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir# general propose empty dummy target
44*cdf0e10cSrcweirgb_Helper_MISCDUMMY := $(gb_Helper_MISC)/DUMMY
45*cdf0e10cSrcweir
46*cdf0e10cSrcweirgb_Helper_REPOSITORYNAMES :=
47*cdf0e10cSrcweir
48*cdf0e10cSrcweir.PHONY : $(WORKDIR)/Misc/PHONY
49*cdf0e10cSrcweir$(gb_Helper_MISCDUMMY) :
50*cdf0e10cSrcweir	@mkdir -p $(dir $@) && touch $@
51*cdf0e10cSrcweir
52*cdf0e10cSrcweirdefine gb_Helper_abbreviate_dirs
53*cdf0e10cSrcweirR=$(REPODIR) && \
54*cdf0e10cSrcweir$(subst $(REPODIR)/,$$R/,S=$(SRCDIR) && \
55*cdf0e10cSrcweir$(subst $(SRCDIR)/,$$S/,O=$(OUTDIR)) && \
56*cdf0e10cSrcweir$(subst $(SRCDIR)/,$$S/,$(subst $(OUTDIR)/,$$O/,W=$(WORKDIR) && $(subst $(WORKDIR)/,$$W/,$(1)))))
57*cdf0e10cSrcweirendef
58*cdf0e10cSrcweir
59*cdf0e10cSrcweirdefine gb_Helper_make_clean_target
60*cdf0e10cSrcweirgb_$(1)_get_clean_target = $(WORKDIR)/Clean/$(1)/$$(1)
61*cdf0e10cSrcweir
62*cdf0e10cSrcweirendef
63*cdf0e10cSrcweir
64*cdf0e10cSrcweirdefine gb_Helper_make_outdir_clean_target
65*cdf0e10cSrcweirgb_$(1)_get_clean_target = $$(subst $(OUTDIR)/,$(WORKDIR)/Clean/OutDir/,$$(call gb_$(1)_get_target,$$(1)))
66*cdf0e10cSrcweir
67*cdf0e10cSrcweirendef
68*cdf0e10cSrcweir
69*cdf0e10cSrcweirdefine gb_Helper_make_dep_target
70*cdf0e10cSrcweirgb_$(1)_get_dep_target = $(WORKDIR)/Dep/$(1)/$$(1).d
71*cdf0e10cSrcweir
72*cdf0e10cSrcweirendef
73*cdf0e10cSrcweir
74*cdf0e10cSrcweirdefine gb_Helper_make_clean_targets
75*cdf0e10cSrcweir$(foreach targettype,$(1),\
76*cdf0e10cSrcweir	$(call gb_Helper_make_clean_target,$(targettype)))
77*cdf0e10cSrcweir
78*cdf0e10cSrcweirendef
79*cdf0e10cSrcweir
80*cdf0e10cSrcweirdefine gb_Helper_make_outdir_clean_targets
81*cdf0e10cSrcweir$(foreach targettype,$(1),\
82*cdf0e10cSrcweir	$(call gb_Helper_make_outdir_clean_target,$(targettype)))
83*cdf0e10cSrcweir
84*cdf0e10cSrcweirendef
85*cdf0e10cSrcweir
86*cdf0e10cSrcweirdefine gb_Helper_make_dep_targets
87*cdf0e10cSrcweir$(foreach targettype,$(1),\
88*cdf0e10cSrcweir	$(call gb_Helper_make_dep_target,$(targettype)))
89*cdf0e10cSrcweir
90*cdf0e10cSrcweirendef
91*cdf0e10cSrcweir
92*cdf0e10cSrcweirdefine gb_Helper_get_outdir_clean_target
93*cdf0e10cSrcweir$$(subst $(OUTDIR)/,$(WORKDIR)/Clean/OutDir/,$(1))
94*cdf0e10cSrcweirendef
95*cdf0e10cSrcweir
96*cdf0e10cSrcweirdefine gb_Helper_register_repository
97*cdf0e10cSrcweirgb_Helper_CURRENTREPOSITORY := $(1)
98*cdf0e10cSrcweirgb_Helper_REPOSITORYNAMES += $(1)
99*cdf0e10cSrcweir
100*cdf0e10cSrcweirendef
101*cdf0e10cSrcweir
102*cdf0e10cSrcweirdefine gb_Helper_add_repository
103*cdf0e10cSrcweirgb_Helper_CURRENTREPOSITORY :=
104*cdf0e10cSrcweirinclude $(1)/Repository.mk
105*cdf0e10cSrcweirifeq ($$(gb_Helper_CURRENTREPOSITORY),)
106*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,No call to gb_Helper_register_repository in Repository.mk for repository $(1)))
107*cdf0e10cSrcweirendif
108*cdf0e10cSrcweir$$(gb_Helper_CURRENTREPOSITORY) := $(1)
109*cdf0e10cSrcweir
110*cdf0e10cSrcweirendef
111*cdf0e10cSrcweir
112*cdf0e10cSrcweirdefine gb_Helper_add_repositories
113*cdf0e10cSrcweir$(foreach repo,$(1),$(call gb_Helper_add_repository,$(repo)))
114*cdf0e10cSrcweir
115*cdf0e10cSrcweirendef
116*cdf0e10cSrcweir
117*cdf0e10cSrcweirdefine gb_Helper_init_registries
118*cdf0e10cSrcweirgb_Executable_VALIDGROUPS := UREBIN SDK OOO BRAND NONE
119*cdf0e10cSrcweirgb_Library_VALIDGROUPS := OOOLIBS PLAINLIBS_NONE PLAINLIBS_URE PLAINLIBS_OOO RTLIBS RTVERLIBS STLLIBS UNOLIBS_URE UNOLIBS_OOO UNOVERLIBS
120*cdf0e10cSrcweirgb_StaticLibrary_VALIDGROUPS := PLAINLIBS
121*cdf0e10cSrcweir
122*cdf0e10cSrcweir$$(foreach group,$$(gb_Executable_VALIDGROUPS),$$(eval gb_Executable_$$(group) :=))
123*cdf0e10cSrcweir$$(foreach group,$$(gb_Library_VALIDGROUPS),$$(eval gb_Library_$$(group) :=))
124*cdf0e10cSrcweir$$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(eval gb_StaticLibrary_$$(group) :=))
125*cdf0e10cSrcweir
126*cdf0e10cSrcweirendef
127*cdf0e10cSrcweir
128*cdf0e10cSrcweirdefine gb_Helper_collect_libtargets
129*cdf0e10cSrcweirgb_Library_TARGETS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group)))
130*cdf0e10cSrcweirgb_StaticLibrary_TARGETS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group)))
131*cdf0e10cSrcweir
132*cdf0e10cSrcweirendef
133*cdf0e10cSrcweir
134*cdf0e10cSrcweirdefine gb_Helper_collect_knownlibs
135*cdf0e10cSrcweirgb_Library_KNOWNLIBS := $$(foreach group,$$(gb_Library_VALIDGROUPS),$$(gb_Library_$$(group)))
136*cdf0e10cSrcweirgb_StaticLibrary_KNOWNLIBS := $$(foreach group,$$(gb_StaticLibrary_VALIDGROUPS),$$(gb_StaticLibrary_$$(group)))
137*cdf0e10cSrcweir
138*cdf0e10cSrcweirendef
139*cdf0e10cSrcweir
140*cdf0e10cSrcweirdefine gb_Helper_register_executables
141*cdf0e10cSrcweirifeq ($$(filter $(1),$$(gb_Executable_VALIDGROUPS)),)
142*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,$(1) is not a valid group for executables. Valid groups are: $$(gb_Executable_VALIDGROUPS)))
143*cdf0e10cSrcweirendif
144*cdf0e10cSrcweir
145*cdf0e10cSrcweirgb_Executable_$(1) += $(2)
146*cdf0e10cSrcweir
147*cdf0e10cSrcweirendef
148*cdf0e10cSrcweir
149*cdf0e10cSrcweirdefine gb_Helper_register_libraries
150*cdf0e10cSrcweirifeq ($$(filter $(1),$$(gb_Library_VALIDGROUPS)),)
151*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,$(1) is not a valid group for libraries. Valid groups are: $$(gb_Library_VALIDGROUPS)))
152*cdf0e10cSrcweirendif
153*cdf0e10cSrcweir
154*cdf0e10cSrcweirgb_Library_$(1) += $(2)
155*cdf0e10cSrcweir
156*cdf0e10cSrcweirendef
157*cdf0e10cSrcweir
158*cdf0e10cSrcweirdefine gb_Helper_register_static_libraries
159*cdf0e10cSrcweirifeq ($$(filter $(1),$$(gb_StaticLibrary_VALIDGROUPS)),)
160*cdf0e10cSrcweir$$(eval $$(call gb_Output_error,$(1) is not a valid group for static libraries. Valid groups are: $$(gb_StaticLibrary_VALIDGROUPS)))
161*cdf0e10cSrcweirendif
162*cdf0e10cSrcweir
163*cdf0e10cSrcweirgb_StaticLibrary_$(1) += $(2)
164*cdf0e10cSrcweir
165*cdf0e10cSrcweirendef
166*cdf0e10cSrcweir
167*cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
168