# Global rules shared by all makefiles -*-Makefile-*- # # Each individual makefile must define the following variables: # TOPSRCDIR : top-level source directory # TOPOBJDIR : top-level object directory # SRCDIR : source directory for this module # MODULE : name of the module being built # # Each individual makefile may define the following additional variables: # C_SRCS : C sources for the module # C_SRCS16 : 16-bit C sources for the module # RC_SRCS : resource source files # SPEC_SRCS : interface definition files # EXTRA_SRCS : extra source files for make depend # 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 # First some useful definitions SHELL = /bin/sh CC = @CC@ CPP = @CPP@ CFLAGS = @CFLAGS@ $(EXTRACFLAGS) OPTIONS = @OPTIONS@ -D_REENTRANT LIBS = @LIBS@ YACC = @YACC@ LEX = @LEX@ LEXLIB = @LEXLIB@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ LIBEXT = @LIBEXT@ DLLEXT = @DLLEXT@ IMPLIBEXT = @IMPLIBEXT@ CROSSCC = @CROSSCC@ LDSHARED = @LDSHARED@ DLLTOOL = @DLLTOOL@ DLLWRAP = @DLLWRAP@ AR = @AR@ rc RANLIB = @RANLIB@ STRIP = @STRIP@ WINDRES = @WINDRES@ LN = @LN@ LN_S = @LN_S@ TOOLSDIR = @TOOLSDIR@ DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL) ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) LD = @LD@ LDFLAGS = @LDFLAGS@ LDCOMBINE = $(LD) -r RM = rm -f MV = mv C2MAN = @C2MAN@ MANSPECS = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \ -w $(TOPSRCDIR)/dlls/user/user32.spec \ -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \ -w $(TOPSRCDIR)/dlls/commdlg/comdlg32.spec \ -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec LINT = @LINT@ LINTFLAGS = @LINTFLAGS@ ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper RUNTEST = $(TOPSRCDIR)/tools/runtest WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild MAKEDEP = $(TOOLSDIR)/tools/makedep WRC = $(TOOLSDIR)/tools/wrc/wrc WMC = $(TOOLSDIR)/tools/wmc/wmc WIDL = $(TOOLSDIR)/tools/widl/widl WRCFLAGS = -J -m $(EXTRAWRCFLAGS) LDPATH = @LDPATH@ DLLDIR = $(TOPOBJDIR)/dlls LIBWINE = -L$(TOPOBJDIR)/library -lwine LIBUNICODE = -L$(TOPOBJDIR)/unicode -lwine_unicode LIBUUID = -L$(TOPOBJDIR)/ole -lwine_uuid @SET_MAKE@ # Installation infos INSTALL = @INSTALL@ $(INSTALL_FLAGS) INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(INSTALL_PROGRAM_FLAGS) INSTALL_SCRIPT = @INSTALL_SCRIPT@ $(INSTALL_SCRIPT_FLAGS) INSTALL_DATA = @INSTALL_DATA@ $(INSTALL_DATA_FLAGS) prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ datadir = @datadir@ infodir = @infodir@ mandir = @mandir@ sysconfdir = @sysconfdir@ includedir = @includedir@/wine dlldir = @libdir@/wine prog_manext = 1 conf_manext = 5 CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \ *.flc *.spec.c *.spec.def *.glue.c *.dbg.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS) RCOBJS = $(RC_SRCS:.rc=.res.o) LINTS = $(C_SRCS:.c=.ln) # Implicit rules .SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .ok .cross.o .c.o: $(CC) -c $(ALLCFLAGS) -o $@ $< .c.cross.o: $(CROSSCC) -c $(ALLCFLAGS) -o $@ $< .s.o: $(AS) -o $@ $< .mc.mc.rc: $(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $< .rc.res: $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ $< .res.res.o: $(WINDRES) -i $< -o $@ .spec.spec.c: $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) --spec $< .spec.spec.def: $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --def $< .c.ln: $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 ) .c.ok: $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@ # 'all' target first in case the enclosing Makefile didn't define any target all: Makefile filter: @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all .PHONY: all filter # Rule for main module debug channels $(MODULE).dbg.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD) $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --debug -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) # Rule to rebuild the tools $(MAKEDEP) $(WINEBUILD) $(WMC) $(WRC): cd $(TOOLSDIR)/tools && $(MAKE) `basename $@` # Rules for makefile Makefile: Makefile.in $(TOPSRCDIR)/configure @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure @exit 1 # Rules for auto documentation $(SUBDIRS:%=%/__man__): dummy cd `dirname $@` && $(MAKE) man man: $(C_SRCS) $(SUBDIRS:%=%/__man__) if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINESRC__ $(MANSPECS) $$i; done; fi $(SUBDIRS:%=%/__doc_html__): dummy cd `dirname $@` && $(MAKE) doc-html doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__) if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/html; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINESRC__ $(MANSPECS) $$i; done; fi .PHONY: man doc-html $(SUBDIRS:%=%/__man__) $(SUBDIRS:%=%/__doc_html__) # Rule for linting $(MODULE).ln : $(LINTS) if test "$(LINTS)" ; \ then \ $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \ $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \ else \ $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \ fi lint:: $(MODULE).ln # Rules for Windows API checking winapi_check:: dummy $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) . .PHONY: winapi_check # Rules for dependencies $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy cd `dirname $@` && $(MAKE) depend depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__) $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS) .PHONY: depend $(SUBDIRS:%=%/__depend__) # Rules for cleaning $(SUBDIRS:%=%/__clean__): dummy cd `dirname $@` && $(MAKE) clean $(SUBDIRS:%=%/__testclean__): dummy cd `dirname $@` && $(MAKE) testclean $(EXTRASUBDIRS:%=%/__clean__): dummy -cd `dirname $@` && $(RM) $(CLEAN_FILES) testclean:: $(SUBDIRS:%=%/__testclean__) clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__) $(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS) .PHONY: clean testclean $(SUBDIRS:%=%/__clean__) $(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__) # Rules for installing $(INSTALLSUBDIRS:%=%/__install__): dummy cd `dirname $@` && $(MAKE) install $(INSTALLSUBDIRS:%=%/__uninstall__): dummy cd `dirname $@` && $(MAKE) uninstall install:: $(INSTALLSUBDIRS:%=%/__install__) uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__) .PHONY: install install-lib install-dev uninstall \ $(INSTALLSUBDIRS:%=%/__install__) $(INSTALLSUBDIRS:%=%/__uninstall__) # Rules for checking that no imports are missing $(SUBDIRS:%=%/__checklink__): dummy @cd `dirname $@` && $(MAKE) checklink .PHONY: checklink $(SUBDIRS:%=%/__checklink__) # Rules for testing $(SUBDIRS:%=%/__test__): dummy @cd `dirname $@` && $(MAKE) test $(SUBDIRS:%=%/__crosstest__): dummy @cd `dirname $@` && $(MAKE) crosstest .PHONY: check test crosstest $(SUBDIRS:%=%/__test__) $(SUBDIRS:%=%/__crosstest__) # Misc. rules $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD) $(RC_SRCS:.rc=.res): $(WRC) $(RC_SRCS16:.rc=.res): $(WRC) $(MC_SRCS:.mc=.mc.rc): $(WMC) $(SUBDIRS): dummy @cd $@ && $(MAKE) dummy: .PHONY: dummy $(SUBDIRS) # End of global rules