Sweden-Number/Make.rules.in

315 lines
8.8 KiB
Makefile

# 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
# ASM_SRCS : assembly sources
# GEN_C_SRCS : generated C files
# GEN_ASM_SRCS : generated assembly sources
# RC_SRCS : resource source files
# SPEC_SRCS : interface definition files
# GLUE : C sources for which glue code needs to be generated
# 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
# PLTESTS : Perl test scripts
# CTESTS : C test sources
# First some useful definitions
SHELL = /bin/sh
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
OPTIONS = @OPTIONS@ -D_REENTRANT
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
XLIB = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
LIBS = @LIBS@
YACC = @YACC@
LEX = @LEX@
LEXLIB = @LEXLIB@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
LIBEXT = @LIBEXT@
DLLEXT = @DLLEXT@
LDSHARED = @LDSHARED@
DLLWRAP = @DLLWRAP@
DLLWRAPFLAGS = --add-stdcall-alias
AR = @AR@ rc
RANLIB = @RANLIB@
STRIP = @STRIP@
WINDRES = @WINDRES@
LN_S = @LN_S@
TOOLSDIR = @TOOLSDIR@
DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
LDCOMBINE = @LDCOMBINE@
LDFLAGS = @LDFLAGS@
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
WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOOLSDIR)/tools/makedep
WRC = $(TOOLSDIR)/tools/wrc/wrc
WMC = $(TOOLSDIR)/tools/wmc/wmc
LDPATH = @LDPATH@
DLLDIR = $(TOPOBJDIR)/dlls
LIBWINE = -L$(TOPOBJDIR)/library -lwine
LIBTSX11 = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
LIBUUID = -L$(TOPOBJDIR)/ole -lwine_uuid
WINETEST = $(TOPOBJDIR)/programs/winetest/winetest
RUNTEST = $(TOPSRCDIR)/programs/winetest/runtest
RUNTESTFLAGS = -q -P wine -M $(MODULE) -T $(TOPOBJDIR)
TESTRESULTS = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok)
TESTPROGRAM = tests/$(MODULE:%.dll=%)_test
TESTLIST = tests/testlist.c
TESTOBJS = $(TESTMAIN) $(TESTLIST:.c=.o) $(CTESTS:.c=.o)
TESTMAIN = $(TOPOBJDIR)/programs/winetest/wtmain.o
@SET_MAKE@
# Installation infos
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_DATA = @INSTALL_DATA@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
dlldir = @libdir@/wine
prog_manext = 1
conf_manext = 5
includedir = @includedir@/wine
CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
*.flc *.spec.c *.spec.def *.glue.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
$(ASM_SRCS:.S=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
LINTS = $(C_SRCS:.c=.ln)
# Implicit rules
.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .glue.c .pl .ok
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
.s.o:
$(AS) -o $@ $<
.S.o:
$(CC) -c -o $@ $<
.mc.mc.rc:
$(LDPATH) $(WMC) -i -H /dev/null -o $@ $<
.rc.res:
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
.res.res.o:
$(WINDRES) -i $< -o $@
.spec.spec.c:
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -spec $<
.spec.spec.def:
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -def $<
.c.glue.c:
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
.c.ln:
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
.c.ok:
$(RUNTEST) $(RUNTESTFLAGS) -p $(TESTPROGRAM) $< && touch $@
.pl.ok:
$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
.PHONY: all install uninstall clean distclean depend dummy check test testclean
# 'all' target first in case the enclosing Makefile didn't define any target
all: Makefile
filter:
@$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
# Rule for main module intermediate object
$(MODULE).tmp.o: $(SPEC_SRCS:.spec=.spec.o) $(OBJS) Makefile.in
$(LDCOMBINE) $(SPEC_SRCS:.spec=.spec.o) $(OBJS) -o $@
-$(STRIP) --strip-unneeded $@
# Rule to rebuild the resource compiler
$(WRC):
cd $(TOOLSDIR)/tools/wrc && $(MAKE) wrc
# Rule to rebuild the message compiler
$(WMC):
cd $(TOOLSDIR)/tools/wmc && $(MAKE) wmc
# Rule to rebuild the 'makedep' program
$(MAKEDEP):
cd $(TOOLSDIR)/tools && $(MAKE) makedep
# Rule to rebuild the 'winebuild' program
$(WINEBUILD):
cd $(TOOLSDIR)/tools/winebuild && $(MAKE) winebuild
# 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__WINE__ $(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__WINE__ $(MANSPECS) $$i; done; fi
# 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::
$(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
# Rules for dependencies
$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
cd `dirname $@` && $(MAKE) depend
depend: $(MAKEDEP) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS) $(CTESTS) -C. $(GEN_C_SRCS)
# 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__)
$(RM) $(TESTRESULTS)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(TESTRESULTS) $(TESTLIST) $(TESTPROGRAM)$(EXEEXT) $(PROGRAMS)
# Rules for installing
$(SUBDIRS:%=%/__install__): dummy
cd `dirname $@` && $(MAKE) install
$(SUBDIRS:%=%/__uninstall__): dummy
cd `dirname $@` && $(MAKE) uninstall
# Rules for testing
check test:: $(TESTRESULTS)
$(SUBDIRS:%=%/__test__): dummy
@cd `dirname $@` && $(MAKE) test
$(PLTESTS:.c=.ok): $(WINETEST)
$(CTESTS:.c=.ok): $(TESTPROGRAM)$(EXEEXT)
$(WINETEST):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest
$(TESTMAIN):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o
$(TESTLIST): Makefile.in
$(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
$(TESTPROGRAM): $(TESTPROGRAM).so
$(RM) $(TESTPROGRAM) && cd tests && $(LN_S) $(TOPOBJDIR)/../wine `basename $(TESTPROGRAM)`
$(TESTPROGRAM).so: $(TESTPROGRAM).spec.o $(TESTOBJS)
$(LDSHARED) $(LDDLLFLAGS) $(TESTPROGRAM).spec.o $(TESTOBJS) -o $@ $(LIBWINE) $(LIBS)
$(TESTPROGRAM).tmp.o: $(TESTOBJS)
$(LDCOMBINE) $(TESTOBJS) -o $@
-$(STRIP) --strip-unneeded $@
$(TESTPROGRAM).spec.c: $(TESTPROGRAM).tmp.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -sym $(TESTPROGRAM).tmp.o -o $@ -exe $(TESTPROGRAM) -mcui -L$(DLLDIR) $(TESTIMPORTS:%=-l%)
$(TESTPROGRAM).exe: $(TESTOBJS)
$(CC) $(TESTOBJS) -o $@ $(TESTIMPORTS:%=-l%) $(LIBWINE) $(LIBS)
# Misc. rules
$(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
$(GLUE:.c=.glue.c): $(WINEBUILD)
$(RC_SRCS:.rc=.res): $(WRC)
$(RC_SRCS16:.rc=.res): $(WRC)
$(MC_SRCS:.mc=.mc.rc): $(WMC)
$(SUBDIRS): dummy
@cd $@ && $(MAKE)
dummy:
# End of global rules