Makeprog.rules.in 2.33 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 (cui,gui,cuiw,guiw)
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 13
DEFS        = @DLLFLAGS@ -DSTRICT -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
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 %)
19 20 21

@MAKE_RULES@

22
all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
23

24 25
# Rule for main module spec file

26 27
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(WINEBUILD)
	$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) $(APPMODE:%=-m%) $(RC_SRCS:%.rc=-res %.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%)
28

29
# Rules for .so main module
30

31 32
$(MODULE).so: $(MODULE).spec.o $(ALL_OBJS) Makefile.in
	$(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(ALL_OBJS) -o $@ $(ALL_LIBS)
33

34 35
$(BASEMODULE): $(WINEWRAPPER)
	$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
36

37 38
# Rules for .exe main module

39
$(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in
40
	$(CC) $(ALL_OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
41

42 43
# Rules for checking that no imports are missing

44 45
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
48

49 50
# Rules for testing

51 52 53
check test:: $(SUBDIRS:%=%/__test__)

$(TESTRESULTS): $(MODULE)$(DLLEXT)
54

55 56
# Rules for installation

57
.PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
58

59
install_prog.so: $(MODULE).so dummy
60 61
	$(MKINSTALLDIRS) $(dlldir)
	$(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
62

63
install_prog: $(MODULE) dummy
64
	$(MKINSTALLDIRS) $(bindir)
65
	$(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
66

67 68 69 70 71 72
uninstall_prog.so: dummy
	$(RM) $(dlldir)/$(MODULE).so

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

73
install:: install_prog$(DLLEXT)
74

75
uninstall:: uninstall_prog$(DLLEXT)
76 77

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