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) $(TOPOBJDIR)/@LIB_TARGET@
33 DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
34 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
40 MANSPECS = -w $(TOPSRCDIR)/relay32/gdi32.spec \
41 -w $(TOPSRCDIR)/relay32/user32.spec \
42 -w $(TOPSRCDIR)/relay32/comctl32.spec \
43 -w $(TOPSRCDIR)/relay32/comdlg32.spec \
44 -w $(TOPSRCDIR)/relay32/kernel32.spec
46 LINTFLAGS = +posixlib +gnuextensions +trytorecover
47 BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
48 MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
49 WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
50 WRC = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
52 WINESTUB = $(TOPOBJDIR)/library/winestub.o
53 SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
59 INSTALL_PROGRAM = @INSTALL_PROGRAM@
60 INSTALL_DATA = @INSTALL_DATA@
62 exec_prefix = @exec_prefix@
66 mandir = @mandir@/man1
68 includedir = @includedir@/wine
70 OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) \
71 $(RC_SRCS:.rc=.o) $(EXTRA_OBJS)
78 $(CC) -c $(ALLCFLAGS) -o $*.o $<
87 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
90 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
93 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
96 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
99 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
103 # echo "#include \"windows.h\"" >$*-tmp.c
104 # echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
106 # $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
110 # echo "#include \"windows.h\"" >$*-tmp.c
111 # echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
113 # $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
118 # Rule to rebuild the resource compiler
120 $(WINERC) check_winerc:
121 cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
124 cd $(TOPOBJDIR)/tools/wrc; $(SUBMAKE) wrc@PROGEXT@
126 # Rule to rebuild the 'makedep' program
128 $(MAKEDEP) check_makedep:
129 cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
131 # Rule to rebuild the 'build' program
134 cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
136 # Rule for main module
139 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
141 # Rules for auto documentation
144 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
147 for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
154 for i in $(C_SRCS); do $(LINT) $(LINTFLAGS) -D__WINE__ $(OPTIONS) $(DIVINCL) $(X_CFLAGS) $$i; done
158 depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
159 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
162 $(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)
166 # End of global rules