1 # Global rules for building a Winelib program -*-Makefile-*-
3 # Each individual makefile should define the following variables:
4 # MODULE : name of the main module being built
5 # APPMODE : program mode (cui,gui,cuiw,guiw)
6 # EXTRALIBS : extra libraries to link in (optional)
7 # EXTRADEFS : extra symbol definitions, like -DWINELIB (optional)
9 # plus all variables required by the global Make.rules.in
12 DEFS = @DLLFLAGS@ $(EXTRADEFS)
13 LDDLLFLAGS = @LDDLLFLAGS@
14 ALL_OBJS = $(OBJS) $(MODULE).dbg.o
15 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
16 BASEMODULE = $(MODULE:.exe=)
17 TESTIMPORTS = $(DELAYIMPORTS) $(IMPORTS)
18 RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR) $(PLTESTPROGRAM:%=-p %)
22 all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
24 # Rule for main module spec file
26 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(WINEBUILD)
27 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) $(APPMODE:%=--exe-mode %) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
29 # Rules for .so main module
31 $(MODULE).so: $(MODULE).spec.o $(ALL_OBJS) Makefile.in
32 $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(ALL_OBJS) -o $@ $(ALL_LIBS) -lc
34 $(BASEMODULE): $(WINEWRAPPER)
35 $(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
37 # Rules for .exe main module
39 $(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in
40 $(CC) $(ALL_OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
44 check test:: $(SUBDIRS:%=%/__test__)
46 $(TESTRESULTS): $(MODULE)$(DLLEXT)
48 # Rules for installation
50 .PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
52 install_prog.so: $(MODULE).so dummy
53 $(MKINSTALLDIRS) $(dlldir)
54 $(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
56 install_prog: $(MODULE) dummy
57 $(MKINSTALLDIRS) $(bindir)
58 $(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
60 uninstall_prog.so: dummy
61 $(RM) $(dlldir)/$(MODULE).so
64 $(RM) $(bindir)/$(MODULE)
66 install:: install_prog$(DLLEXT)
68 uninstall:: uninstall_prog$(DLLEXT)
71 $(RM) $(BASEMODULE) $(MODULE)