1 # Global rules shared by all makefiles -*-Makefile-*-
3 # Each individual makefile should define the following variables:
4 # TOPSRCDIR : top-level source directory
5 # TOPOBJDIR : top-level object directory
6 # SRCDIR : source directory for this module
7 # MODULE : name of the module being built
8 # C_SRCS : C sources for the module (optional)
9 # ASM_SRCS : assembly sources (optional)
10 # GEN_ASM_SRCS : generated assembly sources (optional)
11 # RC_SRCS : resource source files (optional)
12 # EXTRA_SRCS : extra source files for make depend (optional)
13 # EXTRA_OBJS : extra object files (optional)
14 # WRCEXTRA : extra wrc flags (e.g. '-p _SysRes') (optional)
16 # First some useful definitions
22 OPTIONS = @OPTIONS@ -D_REENTRANT
25 XLIB = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
26 WINELIB = $(WINESTUB) -L$(TOPOBJDIR) -lwine
33 DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
34 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
41 MANSPECS = -w $(TOPSRCDIR)/relay32/gdi32.spec \
42 -w $(TOPSRCDIR)/relay32/user32.spec \
43 -w $(TOPSRCDIR)/relay32/comctl32.spec \
44 -w $(TOPSRCDIR)/relay32/comdlg32.spec \
45 -w $(TOPSRCDIR)/relay32/kernel32.spec
47 LINTFLAGS = +posixlib +gnuextensions +trytorecover
48 BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
49 MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
50 WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
51 WRC = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
53 WINESTUB = $(TOPOBJDIR)/library/winestub.o
54 SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
60 INSTALL_PROGRAM = @INSTALL_PROGRAM@
61 INSTALL_DATA = @INSTALL_DATA@
63 exec_prefix = @exec_prefix@
67 mandir = @mandir@/man1
69 includedir = @includedir@/wine
71 OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) \
72 $(RC_SRCS:.rc=.o) $(EXTRA_OBJS)
79 $(CC) -c $(ALLCFLAGS) -o $*.o $<
88 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
91 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
94 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
97 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
100 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
104 # echo "#include \"windows.h\"" >$*-tmp.c
105 # echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
107 # $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
111 # echo "#include \"windows.h\"" >$*-tmp.c
112 # echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
114 # $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
119 # Rule to rebuild the resource compiler
121 $(WINERC) check_winerc:
122 cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
125 cd $(TOPOBJDIR)/tools/wrc; $(SUBMAKE) wrc@PROGEXT@
127 # Rule to rebuild the 'makedep' program
129 $(MAKEDEP) check_makedep:
130 cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
132 # Rule to rebuild the 'build' program
135 cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
137 # Rule for main module
140 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
144 Makefile: Makefile.in $(TOPSRCDIR)/configure
145 @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
150 # Rules for auto documentation
153 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
156 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
161 for i in $(C_SRCS); do $(LINT) $(LINTFLAGS) -D__WINE__ $(OPTIONS) $(DIVINCL) $(X_CFLAGS) $$i; done
165 depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
166 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
169 $(RM) *.o \#*\# *~ *% .#* *.bak *.orig *.rej *.flc *-tmp.c y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(PROGRAMS)
173 # End of global rules