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@ -DSTRICT -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
13 LDDLLFLAGS = @LDDLLFLAGS@
14 ALL_OBJS = $(OBJS) $(MODULE).dbg.o
15 ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(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:%=-m%) $(RC_SRCS:%.rc=-res %.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(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)
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)
42 # Rules for checking that no imports are missing
44 CHECKLINK_RPATH = library tsx11 unicode
46 checklink:: $(MODULE).so $(SUBDIRS:%=%/__checklink__)
47 $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
51 check test:: $(SUBDIRS:%=%/__test__)
53 $(TESTRESULTS): $(MODULE)$(DLLEXT)
55 # Rules for installation
57 .PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
59 install_prog.so: $(MODULE).so dummy
60 $(MKINSTALLDIRS) $(dlldir)
61 $(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
63 install_prog: $(MODULE) dummy
64 $(MKINSTALLDIRS) $(bindir)
65 $(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
67 uninstall_prog.so: dummy
68 $(RM) $(dlldir)/$(MODULE).so
71 $(RM) $(bindir)/$(MODULE)
73 install:: install_prog$(DLLEXT)
75 uninstall:: uninstall_prog$(DLLEXT)
78 $(RM) $(BASEMODULE) $(MODULE)