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 (-mwindows,-mconsole)
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
14 DEFS = $(DLLDEFS) $(EXTRADEFS)
15 ALL_OBJS = $(OBJS) $(MODULE).dbg.o
16 ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
17 ALL_LIBS = $(ALL_IMPORTS:%=-l%) $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
18 DLL_LDPATH = -L$(DLLDIR) $(ALL_IMPORTS:%=-L$(DLLDIR)/%)
19 BASEMODULE = $(MODULE:.exe=)
20 RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR)
24 all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
26 # Rules for .so main module
28 $(MODULE).so: $(ALL_OBJS) $(RC_SRCS:.rc=.res) Makefile.in
29 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild $(APPMODE) $(ALL_OBJS) $(RC_SRCS:.rc=.res) -o $@ $(DLL_LDPATH) $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
31 $(BASEMODULE): $(WINEWRAPPER)
32 $(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
34 # Rules for .exe main module
36 $(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in
37 $(CC) $(APPMODE) $(ALL_OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
41 check test:: $(SUBDIRS:%=%/__test__)
43 $(TESTRESULTS): $(MODULE)$(DLLEXT)
45 # Rules for installation
47 .PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
49 install_prog.so: $(MODULE).so dummy
50 $(MKINSTALLDIRS) $(dlldir)
51 $(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
53 install_prog: $(MODULE) dummy
54 $(MKINSTALLDIRS) $(bindir)
55 $(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
57 uninstall_prog.so: dummy
58 $(RM) $(dlldir)/$(MODULE).so
61 $(RM) $(bindir)/$(MODULE)
63 install:: install_prog$(DLLEXT)
65 uninstall:: uninstall_prog$(DLLEXT)
68 $(RM) $(BASEMODULE) $(MODULE)