blob: 4ef0ab7085a9b6d9383b4e7e655314564d23a8f9 [file] [log] [blame]
Alexandre Julliard626f4252000-11-10 23:35:20 +00001# Global rules for building a Winelib program -*-Makefile-*-
2#
3# Each individual makefile should define the following variables:
4# MODULE : name of the main module being built
Vincent Béron6cef9c02005-03-05 10:47:42 +00005# APPMODE : program mode (-mwindows,-mconsole)
Alexandre Julliard626f4252000-11-10 23:35:20 +00006# EXTRALIBS : extra libraries to link in (optional)
7# EXTRADEFS : extra symbol definitions, like -DWINELIB (optional)
8#
9# plus all variables required by the global Make.rules.in
10#
11
Vincent Béron1f504142004-10-19 23:06:11 +000012DLLDEFS = @DLLDEFS@
Alexandre Julliard16cd8612003-09-24 19:01:44 +000013DLLFLAGS = @DLLFLAGS@
Alexandre Julliard1fd32cf2006-03-20 22:08:26 +010014LDRPATH = @LDDLLRPATH@
Vincent Béron1f504142004-10-19 23:06:11 +000015DEFS = $(DLLDEFS) $(EXTRADEFS)
Alexandre Julliard2dabac02005-05-06 15:54:41 +000016ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
Alexandre Julliard5319db62006-03-16 16:28:43 +010017ALL_LIBS = $(ALL_IMPORTS:%=-l%) -L$(LIBDIR) -lwine $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
Alexandre Julliardcc2ee762002-05-21 19:42:29 +000018BASEMODULE = $(MODULE:.exe=)
Alexandre Julliard6621b2d2004-03-02 21:00:00 +000019RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR)
Alexandre Julliard626f4252000-11-10 23:35:20 +000020
21@MAKE_RULES@
22
Alexandre Julliardcc2ee762002-05-21 19:42:29 +000023all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
Alexandre Julliardfc01b722002-05-12 03:16:39 +000024
Alexandre Julliardfc01b722002-05-12 03:16:39 +000025# Rules for .so main module
Alexandre Julliard626f4252000-11-10 23:35:20 +000026
Alexandre Julliard7ddab752005-09-28 18:34:00 +000027$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
Alexandre Julliard1fd32cf2006-03-20 22:08:26 +010028 $(WINEGCC) -B$(TOOLSDIR)/tools/winebuild $(APPMODE) $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(LDRPATH) -L$(DLLDIR) $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
Alexandre Julliard626f4252000-11-10 23:35:20 +000029
Alexandre Julliard35363162002-05-22 21:32:49 +000030$(BASEMODULE): $(WINEWRAPPER)
31 $(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
Alexandre Julliard626f4252000-11-10 23:35:20 +000032
Alexandre Julliardfc01b722002-05-12 03:16:39 +000033# Rules for .exe main module
34
Alexandre Julliard7ddab752005-09-28 18:34:00 +000035$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
36 $(CC) $(APPMODE) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
Alexandre Julliardfc01b722002-05-12 03:16:39 +000037
Alexandre Julliard13b0c092002-01-10 03:30:21 +000038# Rules for testing
39
Alexandre Julliardedeee892002-08-09 01:22:40 +000040check test:: $(SUBDIRS:%=%/__test__)
41
42$(TESTRESULTS): $(MODULE)$(DLLEXT)
Alexandre Julliard13b0c092002-01-10 03:30:21 +000043
Alexandre Julliard626f4252000-11-10 23:35:20 +000044# Rules for installation
45
Alexandre Julliard35363162002-05-22 21:32:49 +000046.PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
Alexandre Julliardfc01b722002-05-12 03:16:39 +000047
Alexandre Julliardf673b712002-06-14 23:48:27 +000048install_prog.so: $(MODULE).so dummy
Mike Frysinger53928442006-02-14 13:51:38 +010049 $(MKINSTALLDIRS) $(DESTDIR)$(dlldir)
50 $(INSTALL_PROGRAM) $(MODULE).so $(DESTDIR)$(dlldir)/$(MODULE).so
Alexandre Julliard626f4252000-11-10 23:35:20 +000051
Alexandre Julliardf673b712002-06-14 23:48:27 +000052install_prog: $(MODULE) dummy
Mike Frysinger53928442006-02-14 13:51:38 +010053 $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
54 $(INSTALL_PROGRAM) $(MODULE) $(DESTDIR)$(bindir)/$(MODULE)
Alexandre Julliardfc01b722002-05-12 03:16:39 +000055
Alexandre Julliard35363162002-05-22 21:32:49 +000056uninstall_prog.so: dummy
Mike Frysinger53928442006-02-14 13:51:38 +010057 $(RM) $(DESTDIR)$(dlldir)/$(MODULE).so
Alexandre Julliard35363162002-05-22 21:32:49 +000058
59uninstall_prog: dummy
Mike Frysinger53928442006-02-14 13:51:38 +010060 $(RM) $(DESTDIR)$(bindir)/$(MODULE)
Alexandre Julliard35363162002-05-22 21:32:49 +000061
Alexandre Julliardcc2ee762002-05-21 19:42:29 +000062install:: install_prog$(DLLEXT)
Alexandre Julliardfc01b722002-05-12 03:16:39 +000063
Alexandre Julliard35363162002-05-22 21:32:49 +000064uninstall:: uninstall_prog$(DLLEXT)
Alexandre Julliard626f4252000-11-10 23:35:20 +000065
66clean::
Alexandre Julliardcc2ee762002-05-21 19:42:29 +000067 $(RM) $(BASEMODULE) $(MODULE)