251 lines
7.6 KiB
Makefile
251 lines
7.6 KiB
Makefile
# Global rules shared by all makefiles -*-Makefile-*-
|
|
#
|
|
# Each individual makefile may define the following variables:
|
|
# C_SRCS : C sources for the module
|
|
# OBJC_SRCS : Objective-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
|
|
|
|
INCLUDES = -I$(srcdir) -I. -I$(top_srcdir)/include -I$(top_builddir)/include $(EXTRAINCL)
|
|
DEFS = -D__WINESRC__ $(EXTRADEFS)
|
|
ALLCFLAGS = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) $(CFLAGS) $(MODCFLAGS)
|
|
IDLFLAGS = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
|
|
RCFLAGS = --nostdinc $(PORCFLAGS) $(TARGETFLAGS) $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
|
|
RUNTESTFLAGS = -q -P wine -T $(top_builddir) $(TESTDLL:%=-M %) $(TESTMODULE:%=-p %@DLLEXT@)
|
|
|
|
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)
|
|
|
|
TESTMODULE_STRIPPED = $(TESTMODULE:%.exe=%-stripped.exe@DLLEXT@)
|
|
CROSSTESTMODULE = $(TESTMODULE:%_test.exe=%_crosstest.exe)
|
|
|
|
CLEAN_FILES = *.o *.a *.so *.mo *.res *.fake *.ok *.tab.[ch] *.yy.c
|
|
CLEAN_TARGETS = $(MODULE) $(IMPORTLIB:%=lib%.@IMPLIBEXT@) $(IDL_GEN_C_SRCS) $(IDL_GEN_HEADERS) \
|
|
$(IDL_TLB_SRCS:.idl=.tlb) $(IDL_P_SRCS:.idl=_p.c dlldata.c) \
|
|
$(PO_SRCS:.rc=.res rsrc.pot) $(MC_SRCS:.mc=.res msg.pot) $(XTEMPLATE_SRCS:.x=.h) \
|
|
$(TESTMODULE:%=% testlist.c) $(CROSSTESTMODULE)
|
|
|
|
OBJS = $(C_SRCS:.c=.o) $(BISON_SRCS:.y=.tab.o) $(LEX_SRCS:.l=.yy.o) $(IDL_GEN_C_SRCS:.c=.o) $(OBJC_SRCS:.m=.o) \
|
|
$(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_RES) $(RC_SRCS:.rc=.res) $(MC_SRCS:.mc=.res) $(EXTRA_OBJS)
|
|
|
|
CROSSOBJS = $(OBJS:.o=.cross.o)
|
|
|
|
# Implicit rules
|
|
|
|
.SUFFIXES: .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 _r.res _t.res .cross.o .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp
|
|
|
|
.c.o:
|
|
$(CC) -c $(ALLCFLAGS) -o $@ $<
|
|
|
|
.m.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.res:
|
|
$(WMC) -U -O res $(PORCFLAGS) -o $@ $<
|
|
|
|
.rc.res:
|
|
$(WRC) $(RCFLAGS) -o $@ $<
|
|
|
|
.idl.h:
|
|
$(WIDL) $(IDLFLAGS) -h -o $@ $<
|
|
|
|
.idl_c.c:
|
|
$(WIDL) $(IDLFLAGS) -c -o $@ $<
|
|
|
|
.idl_i.c:
|
|
$(WIDL) $(IDLFLAGS) -u -o $@ $<
|
|
|
|
.idl_p.c:
|
|
$(WIDL) $(IDLFLAGS) -p -o $@ $<
|
|
|
|
.idl_r.res:
|
|
$(WIDL) $(IDLFLAGS) -r -o $@ $<
|
|
|
|
.idl_s.c:
|
|
$(WIDL) $(IDLFLAGS) -s -o $@ $<
|
|
|
|
.idl.tlb:
|
|
$(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
|
|
|
|
.idl_t.res:
|
|
$(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
|
|
|
|
.c.ok:
|
|
$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
|
|
|
|
.sfd.ttf:
|
|
$(FONTFORGE) -script $(top_srcdir)/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) $< $@
|
|
|
|
.po.mo:
|
|
$(MSGFMT) -o $@ $<
|
|
|
|
# Rules for IDL files
|
|
|
|
dlldata.c: $(WIDL) Makefile.in
|
|
$(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
|
|
|
|
# Rules for main module
|
|
|
|
$(MODULE) $(MODULE:%=%.so) $(MODULE:%=%.fake): $(MAINSPEC) $(OBJS) Makefile.in
|
|
$(WINEGCC) $(APPMODE) $(MODULEFLAGS) $(OBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) -lwine $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
|
|
|
|
# Rules for static libraries
|
|
|
|
all: $(STATICLIB)
|
|
|
|
$(STATICLIB): $(OBJS) Makefile.in
|
|
$(RM) $@
|
|
$(AR) $(ARFLAGS) $@ $(OBJS)
|
|
$(RANLIB) $@
|
|
|
|
$(STATICLIB:.a=.cross.a): $(CROSSOBJS) Makefile.in
|
|
$(RM) $@
|
|
$(CROSSAR) $(ARFLAGS) $@ $(CROSSOBJS)
|
|
$(CROSSRANLIB) $@
|
|
|
|
# Rules for import libraries
|
|
|
|
$(IMPORTLIB:%=lib%.def.a): $(IMPLIB_SRCS:.c=.o)
|
|
$(RM) $@
|
|
$(AR) $(ARFLAGS) $@ $(IMPLIB_SRCS:.c=.o)
|
|
$(RANLIB) $@
|
|
|
|
$(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
|
|
$(WINEBUILD) $(TARGETFLAGS) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.o)
|
|
|
|
$(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
|
|
$(WINEBUILD) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(srcdir)/$(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o)
|
|
|
|
# Rules for dependencies
|
|
|
|
DEPEND_SRCS = $(C_SRCS) $(OBJC_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_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \
|
|
$(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS)
|
|
|
|
depend: dummy
|
|
$(MAKEDEP) $(MAKEDEPFLAGS) -C$(srcdir) -S$(top_srcdir) -T$(top_builddir) $(EXTRAINCL) $(DEPEND_SRCS)
|
|
|
|
.PHONY: depend
|
|
|
|
# Rules for tests
|
|
|
|
$(TESTMODULE) $(TESTMODULE:%=%.so): $(OBJS) Makefile.in
|
|
$(WINEGCC) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
|
|
|
|
$(TESTMODULE_STRIPPED): $(OBJS) Makefile.in
|
|
$(WINEGCC) -s -Wb,-F,$(TESTMODULE) $(APPMODE) $(OBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
|
|
|
|
$(CROSSTESTMODULE): $(CROSSOBJS) Makefile.in
|
|
$(CROSSWINEGCC) $(CROSSOBJS) -o $@ $(IMPORTS:%=-l%) $(LDFLAGS) $(LIBS)
|
|
|
|
$(WINETEST_RES): $(TESTMODULE_STRIPPED)
|
|
echo "$(TESTMODULE) TESTRES \"$(TESTMODULE_STRIPPED)\"" | $(WRC) $(RCFLAGS) -o $@
|
|
|
|
testlist.c: Makefile.in $(MAKECTESTS)
|
|
$(MAKECTESTS) -o $@ $(C_SRCS)
|
|
|
|
testlist.o testlist.cross.o: testlist.c $(top_srcdir)/include/wine/test.h
|
|
|
|
$(C_SRCS:.c=.ok): $(TESTMODULE:%=%@DLLEXT@) $(TESTDLL:%=../%@DLLEXT@)
|
|
|
|
testclean::
|
|
$(RM) *.ok
|
|
|
|
.PHONY: check test testclean
|
|
|
|
# Rules for man pages
|
|
|
|
MANPAGES = $(MANPAGE) $(EXTRA_MANPAGES)
|
|
|
|
all: $(MANPAGES)
|
|
|
|
install-man-pages:: $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)
|
|
$(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
|
|
|
|
uninstall-man-pages::
|
|
$(RM) $(DESTDIR)$(mandir)/man$(prog_manext)/$(MANPAGE:.man=).$(prog_manext)
|
|
|
|
.PHONY: install-man-pages uninstall-man-pages
|
|
|
|
# Rules for auto documentation
|
|
|
|
manpages:: $(C_SRCS) dummy
|
|
$(C2MAN) -o $(top_builddir)/documentation/man$(api_manext) -R$(top_builddir) -C$(srcdir) $(INCLUDES) -S$(api_manext) $(MAINSPEC:%=-w %) $(C_SRCS)
|
|
|
|
htmlpages:: $(C_SRCS) dummy
|
|
$(C2MAN) -o $(top_builddir)/documentation/html -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
|
|
|
|
sgmlpages:: $(C_SRCS) dummy
|
|
$(C2MAN) -o $(top_builddir)/documentation/api-guide -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
|
|
|
|
xmlpages:: $(C_SRCS) dummy
|
|
$(C2MAN) -o $(top_builddir)/documentation/api-guide-xml -R$(top_builddir) -C$(srcdir) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
|
|
|
|
# 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):
|
|
$(MKDIR_P) -m 755 $@
|
|
|
|
install install-lib install-dev uninstall::
|
|
|
|
.PHONY: install install-lib install-dev uninstall
|
|
|
|
# Rules for resources
|
|
|
|
rsrc.pot: $(WRC)
|
|
$(WRC) $(RCFLAGS) -O pot -o $@ $(PO_SRCS)
|
|
|
|
msg.pot: $(WMC)
|
|
$(WMC) -O pot -o $@ $(MC_SRCS)
|
|
|
|
$(MC_SRCS:.mc=.res): $(WMC) $(ALL_MO_FILES)
|
|
$(RC_SRCS:.rc=.res): $(WRC)
|
|
$(PO_SRCS:.rc=.res): $(ALL_MO_FILES)
|
|
|
|
# Misc. rules
|
|
|
|
$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_TLB_RES) $(IDL_R_SRCS:.idl=_r.res): $(WIDL)
|
|
|
|
# End of global rules
|