Skip to content

Commit

Permalink
bug 757855: move xpidl* logic into a named makefile - batch #1
Browse files Browse the repository at this point in the history
UltraBlame original commit: 30da794ae32ca71964099e32577ef8f370036ded
  • Loading branch information
marco-c committed Sep 28, 2019
1 parent e19298e commit d9c5c0a
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 27 deletions.
23 changes: 22 additions & 1 deletion config/makefiles/test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ check-arglist = $(dir-ts)/arglist.ts
check-autotargets = $(dir-ts)/autotargets_mk.ts
check-export-targets = $(dir-ts)/export-targets-mk.ts
check-XinY = $(dir-ts)/check_XinY_mk.ts
check-xpidl = $(dir-ts)/xpidl-mk.ts
check-tests =\
$(check-arglist) \
$(check-autotargets) \
$(check-export-targets) \
$(check-XinY) \
$(check-xpidl) \
$(NULL)


Expand All @@ -35,6 +37,7 @@ all::

clean:
$(RM) $(check-tests)
@$(MAKE) --no-print-directory -f $(srcdir)/check-xpidl.mk clean-xpidl topsrcdir=$(topsrcdir)

###########################################################################
## Logic processed at compile time so be selective about when to test
Expand Down Expand Up @@ -121,4 +124,22 @@ $(check-export-targets): $(check-export-targets-preqs)
@$(TOUCH) $@
# </CHECK: export-targets.mk>

endif #} findstring check
###########################################################################
##{ <CHECK: xpidl.mk>
check-xpidl-preqs=\
$(call mkdir_deps,$(dir-ts)) \
$(topsrcdir)/config/makefiles/makeutils.mk \
$(topsrcdir)/config/makefiles/xpidl.mk \
$(srcdir)/check-xpidl.mk \
$(NULL)

check-xpidl-args =\
"topsrcdir=$(topsrcdir)" \
"srcdir=$(srcdir)" \
$(NULL)
$(check-xpidl): $(check-xpidl-preqs)
$(MAKE) -f $(srcdir)/check-xpidl.mk check-xpidl $(check-xpidl-args)
@$(TOUCH) $@
#} </check-xpidl.mk>

endif #} findstring MAKECMDGOAL
38 changes: 38 additions & 0 deletions config/makefiles/test/check-xpidl.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- makefile -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

ifdef VERBOSE
$(warning loading test)
endif

USE_AUTOTARGETS_MK = 1
include $(topsrcdir)/config/makefiles/makeutils.mk

basedir = blah
DIST = $(basedir)/dist
DI = $(DIST)/include
IDL_DIR = $(basedir)/idl
INSTALL := cp

XPIDLSRCS = $(srcdir)/check-xpidl.mk

include $(topsrcdir)/config/makefiles/xpidl.mk

$(call requiredfunction,topsrcdir)
$(call requiredfunction,XPIDL_GEN_DIR)

HIDE=@
check-xpidl: xpidl-install-src xpidl-install-headers
$(HIDE)test -d $(DIST) || exit 90
$(HIDE)test -f $(DI)/check-xpidl.mk || exit 91
$(HIDE)test -f $(IDL_DIR)/check-xpidl.mk || exit 92

# Declare targets to avoid including rules.mk
$(DI) $(IDL_DIR):
mkdir -p $@

clean-xpidl:
$(RM) -r $(basedir)
58 changes: 58 additions & 0 deletions config/makefiles/xpidl.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- makefile -*-
# vim:set ts=8 sw=8 sts=8 noet:
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#

# Always declared, general use by:
# js/xpconnect/tests/idl/Makefile.in:libs
# toolkit/crashreporter/test/Makefile.in
XPIDL_GEN_DIR ?= _xpidlgen
GARBAGE_DIRS += $(XPIDL_GEN_DIR)


###########################################################################
## Conditional logic
###########################################################################
ifndef INCLUDED_XPIDL_MK #{
INCLUDED_XPIDL_MK = 1

ifneq (,$(XPIDLSRCS)) #{

ifndef NO_DIST_INSTALL #{
_xpidl-todo_ += xpidl-install-src
_xpidl-todo_ += xpidl-install-headers
endif #}

endif #} XPIDLSRCS

export:: $(_xpidl-todo_)

$(call requiredfunction,mkdir_deps)
endif #} INCLUDED_XPIDL_MK


###########################################################################
## processing targets
###########################################################################
ifdef _xpidl-todo_ #{

## Logic batch #1
xpidl-install-src-preqs=\
$(XPIDLSRCS) \
$(call mkdir_deps,$(IDL_DIR)) \
$(NULL)

xpidl-install-src: $(xpidl-install-src-preqs)
$(INSTALL) $(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val)))

xpidl-install-headers-preqs =\
$(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) \
$(call mkdir_deps,$(DIST)/include) \
$(NULL)
xpidl-install-headers: $(xpidl-install-headers-preqs)
$(INSTALL) $(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val)))

endif #} _xpidl-todo_
18 changes: 5 additions & 13 deletions config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ endif
# Export the elements of $(XPIDLSRCS)
# generating .h and .xpt files and moving them to the appropriate places.

ifneq ($(XPIDLSRCS),)
ifneq ($(XPIDLSRCS),) #{

export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))

Expand Down Expand Up @@ -1316,20 +1316,12 @@ endif # NO_GEN_XPT

GARBAGE_DIRS += $(XPIDL_GEN_DIR)

endif # XPIDLSRCS
endif #} XPIDLSRCS

ifneq ($(XPIDLSRCS),)
# export .idl files to $(IDL_DIR)
ifndef NO_DIST_INSTALL
export:: $(XPIDLSRCS) $(IDL_DIR)
$(INSTALL) $(IFLAGS1) $^

export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(DIST)/include
$(INSTALL) $(IFLAGS1) $^
endif # NO_DIST_INSTALL

endif # XPIDLSRCS

ifndef INCLUDED_XPIDL_MK
include $(topsrcdir)/config/makefiles/xpidl.mk
endif


# General rules for exporting idl files.
Expand Down
58 changes: 58 additions & 0 deletions js/src/config/makefiles/xpidl.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- makefile -*-
# vim:set ts=8 sw=8 sts=8 noet:
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#

# Always declared, general use by:
# js/xpconnect/tests/idl/Makefile.in:libs
# toolkit/crashreporter/test/Makefile.in
XPIDL_GEN_DIR ?= _xpidlgen
GARBAGE_DIRS += $(XPIDL_GEN_DIR)


###########################################################################
## Conditional logic
###########################################################################
ifndef INCLUDED_XPIDL_MK #{
INCLUDED_XPIDL_MK = 1

ifneq (,$(XPIDLSRCS)) #{

ifndef NO_DIST_INSTALL #{
_xpidl-todo_ += xpidl-install-src
_xpidl-todo_ += xpidl-install-headers
endif #}

endif #} XPIDLSRCS

export:: $(_xpidl-todo_)

$(call requiredfunction,mkdir_deps)
endif #} INCLUDED_XPIDL_MK


###########################################################################
## processing targets
###########################################################################
ifdef _xpidl-todo_ #{

## Logic batch #1
xpidl-install-src-preqs=\
$(XPIDLSRCS) \
$(call mkdir_deps,$(IDL_DIR)) \
$(NULL)

xpidl-install-src: $(xpidl-install-src-preqs)
$(INSTALL) $(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val)))

xpidl-install-headers-preqs =\
$(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) \
$(call mkdir_deps,$(DIST)/include) \
$(NULL)
xpidl-install-headers: $(xpidl-install-headers-preqs)
$(INSTALL) $(IFLAGS1) $(foreach val,$^,$(call mkdir_stem,$(val)))

endif #} _xpidl-todo_
18 changes: 5 additions & 13 deletions js/src/config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ endif
# Export the elements of $(XPIDLSRCS)
# generating .h and .xpt files and moving them to the appropriate places.

ifneq ($(XPIDLSRCS),)
ifneq ($(XPIDLSRCS),) #{

export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS))

Expand Down Expand Up @@ -1316,20 +1316,12 @@ endif # NO_GEN_XPT

GARBAGE_DIRS += $(XPIDL_GEN_DIR)

endif # XPIDLSRCS
endif #} XPIDLSRCS

ifneq ($(XPIDLSRCS),)
# export .idl files to $(IDL_DIR)
ifndef NO_DIST_INSTALL
export:: $(XPIDLSRCS) $(IDL_DIR)
$(INSTALL) $(IFLAGS1) $^

export:: $(patsubst %.idl,$(XPIDL_GEN_DIR)/%.h, $(XPIDLSRCS)) $(DIST)/include
$(INSTALL) $(IFLAGS1) $^
endif # NO_DIST_INSTALL

endif # XPIDLSRCS

ifndef INCLUDED_XPIDL_MK
include $(topsrcdir)/config/makefiles/xpidl.mk
endif


# General rules for exporting idl files.
Expand Down

0 comments on commit d9c5c0a

Please sign in to comment.