wine/Make.rules.in

267 lines
7.7 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
# RC_SRCS : resource source 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
# EXTRASUBDIRS : subdirectories that do not contain a Makefile
# MODCFLAGS : extra CFLAGS for this module
# First some useful definitions
SHELL = /bin/sh
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
BISON = @BISON@
FLEX = @FLEX@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
LIBEXT = @LIBEXT@
DLLEXT = @DLLEXT@
TOOLSEXT = @TOOLSEXT@
IMPLIBEXT = @IMPLIBEXT@
LDSHARED = @LDSHARED@
DLLTOOL = @DLLTOOL@
DLLWRAP = @DLLWRAP@
AR = @AR@
ARFLAGS = @ARFLAGS@
RANLIB = @RANLIB@
STRIP = @STRIP@
LN_S = @LN_S@
TOOLSDIR = @TOOLSDIR@
LDFLAGS = @LDFLAGS@
PRELINK = @PRELINK@
RM = rm -f
MV = mv
LINT = @LINT@
LINTFLAGS = @LINTFLAGS@
FONTFORGE = @FONTFORGE@
RSVG = @RSVG@
CONVERT = @CONVERT@
ICOTOOL = @ICOTOOL@
CROSSCC = @CROSSCC@
CROSSTARGET = @CROSSTARGET@
CROSSAR = $(CROSSTARGET)-ar
CROSSRANLIB = $(CROSSTARGET)-ranlib
FAKEEXT = $(DLLEXT:.so=.fake)
INCLUDES = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
EXTRACFLAGS = @EXTRACFLAGS@
ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
TARGETFLAGS = @TARGETFLAGS@
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
BUILDIMAGE = $(TOPSRCDIR)/tools/buildimage
C2MAN = $(TOPSRCDIR)/tools/c2man.pl
RUNTEST = $(TOPSRCDIR)/tools/runtest
WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild$(TOOLSEXT)
MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT)
MAKECTESTS = $(TOOLSDIR)/tools/make_ctests$(TOOLSEXT)
WRC = $(TOOLSDIR)/tools/wrc/wrc$(TOOLSEXT)
WMC = $(TOOLSDIR)/tools/wmc/wmc$(TOOLSEXT)
WIDL = $(TOOLSDIR)/tools/widl/widl$(TOOLSEXT)
WINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(TARGETFLAGS) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(TOPOBJDIR) @UNWINDFLAGS@
CROSSWINEGCC = $(TOOLSDIR)/tools/winegcc/winegcc $(CROSSTARGET:%=-b %) -B$(TOOLSDIR)/tools/winebuild --sysroot=$(TOPOBJDIR) --lib-suffix=.cross.a
RELPATH = $(TOOLSDIR)/tools/relpath$(TOOLSEXT)
SFNT2FNT = $(TOOLSDIR)/tools/sfnt2fnt$(TOOLSEXT)
RC = $(WRC)
RCFLAGS = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
LDPATH = @LDPATH@
DLLDIR = $(TOPOBJDIR)/dlls
LIBPORT = $(TOPOBJDIR)/libs/port/libwine_port.a
LIBWPP = $(TOPOBJDIR)/libs/wpp/libwpp.a
LIBWINE = -L$(TOPOBJDIR)/libs/wine -lwine
LDRPATH_INSTALL = @LDRPATH_INSTALL@
LDRPATH_LOCAL = @LDRPATH_LOCAL@
@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@
datarootdir = @datarootdir@
datadir = @datadir@
infodir = @infodir@
mandir = @mandir@
sysconfdir = @sysconfdir@
includedir = @includedir@/wine
dlldir = @libdir@/wine
fakedlldir = $(dlldir)/fakedlls
prog_manext = 1
api_manext = 3w
conf_manext = 5
CLEAN_FILES = *.o *.a *.so *.ln *.res *.fake *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej *.flc core
IDL_GEN_C_SRCS = $(IDL_C_SRCS:.idl=_c.c) $(IDL_I_SRCS:.idl=_i.c) \
$(IDL_P_SRCS:.idl=_p.c) $(IDL_S_SRCS:.idl=_s.c)
IDL_GEN_HEADERS = $(IDL_H_SRCS:.idl=.h) $(IDL_C_SRCS:.idl=.h) $(IDL_I_SRCS:.idl=.h) \
$(IDL_P_SRCS:.idl=.h) $(IDL_S_SRCS:.idl=.h)
CLEAN_TARGETS = $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:%=dlldata.c) \
$(BISON_SRCS:.y=.tab.c) $(BISON_SRCS:.y=.tab.h) $(LEX_SRCS:.l=.yy.c) $(MC_SRCS:.mc=.mc.rc)
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) \
$(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res) $(EXTRA_OBJS)
CROSSOBJS = $(OBJS:.o=.cross.o)
LINTS = $(C_SRCS:.c=.ln)
# 'all' target first in case the enclosing Makefile didn't define any target
all:
filter: dummy
@$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
.PHONY: all filter
# Implicit rules
.SUFFIXES: .mc .rc .mc.rc .res .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok .man.in .man _c.c _i.c _p.c _s.c .cross.o @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
.c.cross.o:
$(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $<
.y.tab.c:
$(BISON) $(BISONFLAGS) -p $*_ -o $@ $<
.y.tab.h:
$(BISON) $(BISONFLAGS) -p $*_ -o $*.tab.c -d $<
.l.yy.c:
$(FLEX) $(LEXFLAGS) -o$@ $<
.mc.mc.rc:
$(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
.rc.res:
$(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
.idl.h:
$(WIDL) $(IDLFLAGS) -h -H $@ $<
.idl_c.c:
$(WIDL) $(IDLFLAGS) -c -C $@ $<
.idl_i.c:
$(WIDL) $(IDLFLAGS) -u -U $@ $<
.idl_p.c:
$(WIDL) $(IDLFLAGS) -p -P $@ $<
.idl_s.c:
$(WIDL) $(IDLFLAGS) -s -S $@ $<
.idl.tlb:
$(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $<
.c.ln:
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
.c.ok:
$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
.sfd.ttf:
$(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $< $@
.man.in.man:
LC_ALL=C sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' -e 's,@PACKAGE_STRING\@,@PACKAGE_STRING@,g' $< >$@ || ($(RM) $@ && false)
.svg.ico:
CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
.svg.bmp:
CONVERT="$(CONVERT)" ICOTOOL="$(ICOTOOL)" RSVG="$(RSVG)" $(BUILDIMAGE) $< $@
# Rules for IDL files
dlldata.c: $(WIDL) Makefile.in
$(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
# 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
DEPEND_SRCS = $(C_SRCS) $(RC_SRCS) $(MC_SRCS) \
$(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \
$(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
$(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
depend: dummy
$(MAKEDEP) $(MAKEDEPFLAGS) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(EXTRAINCL) $(DEPEND_SRCS)
.PHONY: depend
# Rules for cleaning
$(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
clean:: $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(CLEAN_TARGETS) $(PROGRAMS) $(MANPAGES)
.PHONY: clean $(EXTRASUBDIRS:%=%/__clean__)
# Rules for installing
$(INSTALLDIRS):
$(MKINSTALLDIRS) $@
install install-lib install-dev uninstall::
.PHONY: install install-lib install-dev uninstall
# Misc. rules
$(MC_SRCS:.mc=.mc.rc): $(WMC)
$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL)
$(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.mc.res): $(WRC)
dummy:
.PHONY: dummy
# End of global rules