Makeprog.rules.in 1.84 KB
Newer Older
1 2 3 4
# Global rules for building a Winelib program     -*-Makefile-*-
#
# Each individual makefile should define the following variables:
# MODULE       : name of the main module being built
5
# APPMODE      : program mode (-mwindows,-mconsole)
6 7 8 9 10 11
# EXTRALIBS    : extra libraries to link in (optional)
# EXTRADEFS    : extra symbol definitions, like -DWINELIB (optional)
#
# plus all variables required by the global Make.rules.in
#

12
DLLDEFS     = @DLLDEFS@
13
DLLFLAGS    = @DLLFLAGS@
14
DEFS        = $(DLLDEFS) $(EXTRADEFS)
15 16
ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
ALL_LIBS    = $(ALL_IMPORTS:%=-l%) $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
17
DLL_LDPATH  = -L$(DLLDIR) $(ALL_IMPORTS:%=-L$(DLLDIR)/%)
18
BASEMODULE  = $(MODULE:.exe=)
19
RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR)
20 21 22

@MAKE_RULES@

23
all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
24 25

# Rules for .so main module
26

27 28
$(MODULE).so: $(OBJS) $(RC_SRCS:.rc=.res) Makefile.in
	$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild $(APPMODE) $(OBJS) $(RC_SRCS:.rc=.res) -o $@ $(DLL_LDPATH) $(ALL_LIBS) $(DELAYIMPORTS:%=-Wb,-d%)
29

30 31
$(BASEMODULE): $(WINEWRAPPER)
	$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
32

33 34
# Rules for .exe main module

35 36
$(MODULE): $(OBJS) $(RCOBJS) Makefile.in
	$(CC) $(APPMODE) $(OBJS) $(RCOBJS) -o $@ $(ALL_LIBS)
37

38 39
# Rules for testing

40 41 42
check test:: $(SUBDIRS:%=%/__test__)

$(TESTRESULTS): $(MODULE)$(DLLEXT)
43

44 45
# Rules for installation

46
.PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
47

48
install_prog.so: $(MODULE).so dummy
49 50
	$(MKINSTALLDIRS) $(dlldir)
	$(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
51

52
install_prog: $(MODULE) dummy
53
	$(MKINSTALLDIRS) $(bindir)
54
	$(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
55

56 57 58 59 60 61
uninstall_prog.so: dummy
	$(RM) $(dlldir)/$(MODULE).so

uninstall_prog: dummy
	$(RM) $(bindir)/$(MODULE)

62
install:: install_prog$(DLLEXT)
63

64
uninstall:: uninstall_prog$(DLLEXT)
65 66

clean::
67
	$(RM) $(BASEMODULE) $(MODULE)