Added winebuild support for generating a .dbg.c file containing the
[wine/multimedia.git] / programs / Makeprog.rules.in
blobc4a9d90aef0711a27caca35676f28077a6f2755d
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 SYMBOLFILE  = $(MODULE).tmp.o
17 TESTIMPORTS = $(DELAYIMPORTS) $(IMPORTS)
18 RCOBJS      = $(RC_SRCS:.rc=.res.o)
20 @MAKE_RULES@
22 all: $(MODULE)$(EXEEXT)
24 # Rule for main module spec file
26 $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
27         $(LDPATH) $(WINEBUILD) $(DEFS) $(SYMBOLFILE:%=-sym %) -o $@ -exe $(MODULE) $(APPMODE:%=-m%) $(RC_SRCS:%.rc=-res %.res) -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 $(MODULE): $(MODULE).so
35         $(RM) $(MODULE) && $(LN_S) $(TOPOBJDIR)/wine $(MODULE)
37 # Rules for .exe main module
39 $(MODULE).exe: $(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:: $(MODULE).so
45         $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
47 # Rules for testing
49 $(TESTRESULTS): $(MODULE).so
51 # Rules for installation
53 .PHONY: install_prog$(EXEEXT)
55 install_prog:: $(MODULE).so
56         $(MKINSTALLDIRS) $(bindir)
57         $(INSTALL_PROGRAM) $(MODULE).so $(bindir)/$(MODULE).so
58         cd $(bindir) && $(RM) $(MODULE) && $(LN_S) wine $(MODULE)
60 install_prog.exe:: $(MODULE).exe
61         $(MKINSTALLDIRS) $(bindir)
62         $(INSTALL_PROGRAM) $(MODULE).exe $(bindir)/$(MODULE).exe
64 install:: install_prog$(EXEEXT)
66 uninstall::
67         $(RM) $(bindir)/$(MODULE)$(EXEEXT) $(bindir)/$(MODULE).so
69 clean::
70         $(RM) $(MODULE)$(EXEEXT)