wine/programs/Makeprog.rules.in
2002-05-12 03:16:39 +00:00

75 lines
2.1 KiB
Makefile

# Global rules for building a Winelib program -*-Makefile-*-
#
# Each individual makefile should define the following variables:
# MODULE : name of the main module being built
# APPMODE : program mode (cui,gui,cuiw,guiw)
# EXTRALIBS : extra libraries to link in (optional)
# EXTRADEFS : extra symbol definitions, like -DWINELIB (optional)
#
# plus all variables required by the global Make.rules.in
#
DEFS = @DLLFLAGS@ -DSTRICT -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
LDDLLFLAGS = @LDDLLFLAGS@
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
SYMBOLFILE = $(MODULE).tmp.o
TESTIMPORTS = $(DELAYIMPORTS) $(IMPORTS)
RCOBJS = $(RC_SRCS:.rc=.res.o)
@MAKE_RULES@
all: $(MODULE)$(EXEEXT)
# Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ $(SYMBOLFILE:%=-sym %) -o $@ -exe $(MODULE) $(APPMODE:%=-m%) $(RC_SRCS:%.rc=-res %.res) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%)
# Rules for .so main module
$(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS)
$(MODULE): $(MODULE).so
$(RM) $(MODULE) && $(LN_S) $(TOPOBJDIR)/wine $(MODULE)
# Rules for .exe main module
$(MODULE).exe: $(OBJS) $(RCOBJS) Makefile.in
$(CC) $(OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
# Rules for checking that no imports are missing
checklink:: $(MODULE).so
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
# Rules for testing
$(TESTRESULTS): $(MODULE).so
# Rules for debug channels
debug_channels: dummy
$(TOPSRCDIR)/tools/make_debug $(MODULE).spec $(C_SRCS)
# Rules for installation
.PHONY: install_prog$(EXEEXT)
install_prog:: $(MODULE).so
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE).so $(bindir)/$(MODULE).so
cd $(bindir) && $(RM) $(MODULE) && $(LN_S) wine $(MODULE)
install_prog.exe:: $(MODULE).exe
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE).exe $(bindir)/$(MODULE).exe
install:: install_prog$(EXEEXT)
uninstall::
$(RM) $(bindir)/$(MODULE)$(EXEEXT) $(bindir)/$(MODULE).so
clean::
$(RM) $(MODULE)$(EXEEXT)