Commit 93f03393 authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Move all the recursion rules to the top-level makefile.

parent 52c400e9
......@@ -13,9 +13,7 @@
# EXTRA_OBJS : extra object files
# IMPORTS : dlls to import
# DELAYIMPORTS : dlls to import in delayed mode
# SUBDIRS : subdirectories that contain a Makefile
# EXTRASUBDIRS : subdirectories that do not contain a Makefile
# INSTALLSUBDIRS : subdirectories to run make install/uninstall into
# MODCFLAGS : extra CFLAGS for this module
# First some useful definitions
......@@ -229,92 +227,29 @@ DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
$(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
$(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
$(SUBDIRS:%=%/__depend__): dummy
@cd `dirname $@` && $(MAKE) depend
depend: $(SUBDIRS:%=%/__depend__) dummy
depend: dummy
$(MAKEDEP) $(MAKEDEPFLAGS) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)
.PHONY: depend $(SUBDIRS:%=%/__depend__)
.PHONY: depend
# Rules for cleaning
$(SUBDIRS:%=%/__clean__): dummy
@cd `dirname $@` && $(MAKE) clean
$(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
clean:: $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
.PHONY: clean $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
.PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
# Rules for installing
$(SUBDIRS:%=%/__install__): dummy
@cd `dirname $@` && $(MAKE) install
$(SUBDIRS:%=%/__install-lib__): dummy
@cd `dirname $@` && $(MAKE) install-lib
$(SUBDIRS:%=%/__install-dev__): dummy
@cd `dirname $@` && $(MAKE) install-dev
$(SUBDIRS:%=%/__uninstall__): dummy
@cd `dirname $@` && $(MAKE) uninstall
install:: $(INSTALLSUBDIRS:%=%/__install__) dummy
install-lib:: $(INSTALLSUBDIRS:%=%/__install-lib__) dummy
install-dev:: $(INSTALLSUBDIRS:%=%/__install-dev__) dummy
uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__) dummy
$(INSTALLDIRS):
$(MKINSTALLDIRS) $@
.PHONY: install install-lib install-dev uninstall \
$(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
$(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
# Rules for testing
$(TESTSUBDIRS:%=%/__test__): dummy
@cd `dirname $@` && $(MAKE) test
$(TESTSUBDIRS:%=%/__crosstest__): dummy
@cd `dirname $@` && $(MAKE) crosstest
$(TESTSUBDIRS:%=%/__testclean__): dummy
@cd `dirname $@` && $(MAKE) testclean
install install-lib install-dev uninstall::
check test:: $(TESTSUBDIRS:%=%/__test__) dummy
crosstest:: $(TESTSUBDIRS:%=%/__crosstest__) dummy
testclean:: $(TESTSUBDIRS:%=%/__testclean__) dummy
.PHONY: check test testclean crosstest $(TESTSUBDIRS:%=%/__test__) $(TESTSUBDIRS:%=%/__crosstest__) $(TESTSUBDIRS:%=%/__testclean__)
# Rules for auto documentation
$(DOCSUBDIRS:%=%/__man__): dummy
@cd `dirname $@` && $(MAKE) man
$(DOCSUBDIRS:%=%/__doc_html__): dummy
@cd `dirname $@` && $(MAKE) doc-html
$(DOCSUBDIRS:%=%/__doc_sgml__): dummy
@cd `dirname $@` && $(MAKE) doc-sgml
$(DOCSUBDIRS:%=%/__doc_xml__): dummy
@cd `dirname $@` && $(MAKE) doc-xml
man: $(DOCSUBDIRS:%=%/__man__)
doc-html: $(DOCSUBDIRS:%=%/__doc_html__)
doc-sgml: $(DOCSUBDIRS:%=%/__doc_sgml__)
doc-xml: $(DOCSUBDIRS:%=%/__doc_xml__)
.PHONY: man doc-html doc-sgml doc-xml $(DOCSUBDIRS:%=%/__man__) $(DOCSUBDIRS:%=%/__doc_html__) $(DOCSUBDIRS:%=%/__doc_sgml__) $(DOCSUBDIRS:%=%/__doc_xml__)
.PHONY: install install-lib install-dev uninstall
# Misc. rules
......@@ -324,11 +259,8 @@ $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
$(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
$(SUBDIRS): dummy
@cd $@ && $(MAKE)
dummy:
.PHONY: dummy $(SUBDIRS)
.PHONY: dummy
# End of global rules
......@@ -36,9 +36,6 @@ ALL_TEST_DIRS = @ALL_TEST_DIRS@
ALL_TOOL_DIRS = @ALL_TOOL_DIRS@
ALL_TOP_DIRS = @ALL_TOP_DIRS@
# Sub-directories to run make depend/clean into
SUBDIRS = $(ALL_DIRS)
# Sub-directories to run make all into
BUILDSUBDIRS = \
libs/wine \
......@@ -58,12 +55,6 @@ INSTALLSUBDIRS = \
$(ALL_DLL_DIRS) \
$(ALL_INSTALL_DIRS)
# Sub-directories to run make test into
TESTSUBDIRS = $(ALL_TEST_DIRS)
# Sub-directories that contain documentation
DOCSUBDIRS = $(ALL_DLL_DIRS)
# Sub-directories that don't have a makefile
EXTRASUBDIRS = dlls libs
......@@ -74,6 +65,10 @@ WINAPI_CHECK_EXTRA_FLAGS = --global
@MAKE_RULES@
# Rules for re-running configure
ALL_CONFIGS = Makefile $(ALL_DIRS:%=%/Makefile) @ALL_MAKERULES@ @ALL_SYMLINKS@
$(SRCDIR)/configure: @MAINTAINER_MODE@ configure.ac aclocal.m4
cd $(SRCDIR) && autoconf --warnings=all
......@@ -89,12 +84,110 @@ include/config.h: include/stamp-h
include/stamp-h: include/config.h.in config.status
@./config.status include/config.h include/stamp-h
# Installation rules
$(ALL_CONFIGS):
@./config.status $@
# Rules for building
all: $(BUILDSUBDIRS)
$(ALL_DIRS): dummy
@cd $@ && $(MAKE)
.PHONY: $(ALL_DIRS)
# Rules for dependencies
$(ALL_DIRS:%=%/__depend__): dummy
@cd `dirname $@` && $(MAKE) depend
depend: $(MAKEDEP) $(ALL_DIRS:%=%/__depend__) dummy
.PHONY: $(ALL_DIRS:%=%/__depend__)
# Rules for cleaning
$(ALL_DIRS:%=%/__clean__): dummy
@cd `dirname $@` && $(MAKE) clean
clean:: $(ALL_DIRS:%=%/__clean__)
distclean:: clean
$(RM) config.* configure.lineno TAGS tags include/config.h include/stamp-h $(ALL_CONFIGS)
$(RM) -r autom4te.cache
.PHONY: distclean $(ALL_DIRS:%=%/__clean__)
# Rules for installing
$(INSTALLSUBDIRS:%=%/__install__): dummy
@cd `dirname $@` && $(MAKE) install
$(INSTALLSUBDIRS:%=%/__install-lib__): dummy
@cd `dirname $@` && $(MAKE) install-lib
$(INSTALLSUBDIRS:%=%/__install-dev__): dummy
@cd `dirname $@` && $(MAKE) install-dev
$(INSTALLSUBDIRS:%=%/__uninstall__): dummy
@cd `dirname $@` && $(MAKE) uninstall
install:: $(INSTALLSUBDIRS:%=%/__install__) dummy
install-lib:: $(INSTALLSUBDIRS:%=%/__install-lib__) dummy
install-dev:: $(INSTALLSUBDIRS:%=%/__install-dev__) dummy
uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__) dummy
.PHONY: $(INSTALLSUBDIRS:%=%/__install__) $(INSTALLSUBDIRS:%=%/__uninstall__) \
$(INSTALLSUBDIRS:%=%/__install-lib__) $(INSTALLSUBDIRS:%=%/__install-dev__)
uninstall::
-rmdir $(DESTDIR)$(datadir)/wine $(DESTDIR)$(fakedlldir) $(DESTDIR)$(dlldir)
# Import libraries
# Rules for testing
$(ALL_TEST_DIRS:%=%/__test__): dummy
@cd `dirname $@` && $(MAKE) test
$(ALL_TEST_DIRS:%=%/__crosstest__): dummy
@cd `dirname $@` && $(MAKE) crosstest
$(ALL_TEST_DIRS:%=%/__testclean__): dummy
@cd `dirname $@` && $(MAKE) testclean
check test:: $(ALL_TEST_DIRS:%=%/__test__)
crosstest:: $(ALL_TEST_DIRS:%=%/__crosstest__)
testclean:: $(ALL_TEST_DIRS:%=%/__testclean__)
.PHONY: check test testclean crosstest $(ALL_TEST_DIRS:%=%/__test__) \
$(ALL_TEST_DIRS:%=%/__crosstest__) $(ALL_TEST_DIRS:%=%/__testclean__)
# Rules for auto documentation
DOCSUBDIRS = $(ALL_DLL_DIRS)
$(DOCSUBDIRS:%=%/__man__): dummy
@cd `dirname $@` && $(MAKE) man
$(DOCSUBDIRS:%=%/__doc_html__): dummy
@cd `dirname $@` && $(MAKE) doc-html
$(DOCSUBDIRS:%=%/__doc_sgml__): dummy
@cd `dirname $@` && $(MAKE) doc-sgml
$(DOCSUBDIRS:%=%/__doc_xml__): dummy
@cd `dirname $@` && $(MAKE) doc-xml
man: $(DOCSUBDIRS:%=%/__man__)
doc-html: $(DOCSUBDIRS:%=%/__doc_html__)
doc-sgml: $(DOCSUBDIRS:%=%/__doc_sgml__)
doc-xml: $(DOCSUBDIRS:%=%/__doc_xml__)
manpages htmlpages sgmlpages xmlpages: dummy
@cd documentation && $(MAKE) $@
.PHONY: man doc-html doc-sgml doc-xml manpages htmlpages sgmlpages xmlpages \
$(DOCSUBDIRS:%=%/__man__) $(DOCSUBDIRS:%=%/__doc_html__) $(DOCSUBDIRS:%=%/__doc_sgml__) $(DOCSUBDIRS:%=%/__doc_xml__)
# Rules for import libraries
STATIC_LIBS = @ALL_STATIC_LIBS@
IMPORT_LIBS = @ALL_IMPORT_LIBS@
......@@ -104,8 +197,6 @@ implib: $(ALL_STATICLIB_DIRS) $(IMPORT_LIBS)
# Dependencies between directories
all: $(BUILDSUBDIRS)
# dependencies needed to build any dll or program
__builddeps__: libs/port libs/wine libs/wpp $(ALL_TOOL_DIRS) include $(ALL_STATICLIB_DIRS) $(IMPORT_LIBS)
__buildcrossdeps__: libs/port libs/wine $(ALL_TOOL_DIRS) include $(STATIC_LIBS:.a=.cross.a) $(IMPORT_LIBS:.def=.cross.a)
......@@ -142,8 +233,6 @@ RECURSE_TARGETS = \
__uninstall__ \
__crosstest__
depend: $(MAKEDEP)
$(MAKEDEP): include/config.h tools/Makefile
@cd $(TOOLSDIR)/tools && $(MAKE) makedep$(TOOLSEXT)
......@@ -157,26 +246,10 @@ tags ctags:
$(RM) tags
(test -d .git && git ls-files '*.[chly]' '*.idl' || find -L $(TOPSRCDIR) -name '*.[ch]' -print) | xargs ctags -a
manpages htmlpages sgmlpages xmlpages: dummy
@cd documentation && $(MAKE) $@
distclean:: clean
$(RM) config.* configure.lineno TAGS tags include/config.h include/stamp-h
$(RM) -r autom4te.cache
.PHONY: manpages htmlpages sgmlpages xmlpages distclean
# Makefile rules
ALL_CONFIGS = Makefile $(ALL_DIRS:%=%/Makefile) @ALL_MAKERULES@ @ALL_SYMLINKS@
$(ALL_CONFIGS):
@./config.status $@
.INIT: Makefile
.BEGIN: Makefile
.MAKEFILEDEPS:
distclean::
$(RM) $(ALL_CONFIGS)
@ALL_MAKEFILE_DEPENDS@
......@@ -31,6 +31,8 @@ all: $(TESTPROGRAM)
$(MODULE) $(MODULE).so: $(OBJS) Makefile.in
$(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(LIBPORT) $(ALL_LIBS)
.PHONY: check test testclean crosstest
# Rules for building test list
testlist.c: Makefile.in $(MAKECTESTS)
......
......@@ -21,7 +21,7 @@ INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(datadir)/w
@MAKE_RULES@
all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT) $(SUBDIRS)
all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT)
$(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(OBJS) Makefile.in
$(WINEGCC) -shared $(SRCDIR)/$(MAINSPEC) $(OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
......@@ -30,9 +30,9 @@ $(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(OBJS) Makefile.in
IMPLIB_CROSSOBJS = $(IMPLIB_OBJS:.o=.cross.o)
.PHONY: implib $(IMPLIB_SRCS:%=__static_implib__%)
.PHONY: $(IMPLIB_SRCS:%=__static_implib__%)
all implib: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
all: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
$(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
......@@ -50,14 +50,6 @@ $(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_OBJS)
$(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_CROSSOBJS)
$(WINEBUILD) $(IMPLIBFLAGS) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(SRCDIR)/$(MAINSPEC) $(IMPLIB_CROSSOBJS)
$(SUBDIRS): implib
# Rules for testing
check test:: $(SUBDIRS:%=%/__test__) dummy
crosstest:: $(SUBDIRS:%=%/__crosstest__) dummy
# Rules for auto documentation
man: $(C_SRCS) dummy
......
......@@ -12,7 +12,6 @@
DLLFLAGS = @DLLFLAGS@
DEFS = -DWINE_STRICT_PROTOTYPES $(EXTRADEFS)
ALL_LIBS = $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(EXTRALIBS) -lwine $(LIBPORT) $(LDFLAGS) $(LIBS)
RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR)
INSTALLDIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(mandir)/man$(prog_manext)
@MAKE_RULES@
......@@ -22,12 +21,6 @@ all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT)
$(MODULE) $(MODULE).so $(MODULE).fake: $(OBJS) Makefile.in
$(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
# Rules for testing
check test:: $(SUBDIRS:%=%/__test__) dummy
$(TESTRESULTS): $(MODULE)$(DLLEXT)
# Rules for installation
.PHONY: install_prog install_prog.so install_prog.fake
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment