Sweden-Number/programs/Makeprog.rules.in

72 lines
2.0 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@ -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
LDDLLFLAGS = @LDDLLFLAGS@
ALL_OBJS = $(OBJS) $(MODULE).dbg.o
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
BASEMODULE = $(MODULE:.exe=)
TESTIMPORTS = $(DELAYIMPORTS) $(IMPORTS)
RUNTESTFLAGS= -q -P wine -T $(TOPOBJDIR) $(PLTESTPROGRAM:%=-p %)
@MAKE_RULES@
all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
# Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) $(APPMODE:%=-m%) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
# Rules for .so main module
$(MODULE).so: $(MODULE).spec.o $(ALL_OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(ALL_OBJS) -o $@ $(ALL_LIBS) -lc
$(BASEMODULE): $(WINEWRAPPER)
$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
# Rules for .exe main module
$(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in
$(CC) $(ALL_OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
# Rules for testing
check test:: $(SUBDIRS:%=%/__test__)
$(TESTRESULTS): $(MODULE)$(DLLEXT)
# Rules for installation
.PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
install_prog.so: $(MODULE).so dummy
$(MKINSTALLDIRS) $(dlldir)
$(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
install_prog: $(MODULE) dummy
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
uninstall_prog.so: dummy
$(RM) $(dlldir)/$(MODULE).so
uninstall_prog: dummy
$(RM) $(bindir)/$(MODULE)
install:: install_prog$(DLLEXT)
uninstall:: uninstall_prog$(DLLEXT)
clean::
$(RM) $(BASEMODULE) $(MODULE)