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
26 XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
27 WINELIB = $(WINESTUB) $(TOPOBJDIR)/@LIB_TARGET@
34 DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
35 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
42 LINTFLAGS = +posixlib +gnuextensions +trytorecover
43 BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
44 MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
45 WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
46 WRC = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
48 WINESTUB = $(TOPOBJDIR)/library/winestub.o
49 SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
55 INSTALL_PROGRAM = @INSTALL_PROGRAM@
56 INSTALL_DATA = @INSTALL_DATA@
58 exec_prefix = @exec_prefix@
62 mandir = @mandir@/man1
64 includedir = @includedir@/wine
66 OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) \
67 $(RC_SRCS:.rc=.o) $(EXTRA_OBJS)
74 $(CC) -c $(ALLCFLAGS) -o $*.o $<
83 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
86 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
89 $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
92 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
95 $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
99 # echo "#include \"windows.h\"" >$*-tmp.c
100 # echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
102 # $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
106 # echo "#include \"windows.h\"" >$*-tmp.c
107 # echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
109 # $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
114 # Rule to rebuild the resource compiler
116 $(WINERC) check_winerc:
117 cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
120 cd $(TOPOBJDIR)/tools/wrc; $(SUBMAKE) wrc@PROGEXT@
122 # Rule to rebuild the 'makedep' program
124 $(MAKEDEP) check_makedep:
125 cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
127 # Rule to rebuild the 'build' program
130 cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
132 # Rule for main module
135 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
140 for i in $(C_SRCS); do $(C2MAN) -L -o$(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) $$i; done
145 for i in $(C_SRCS); do $(LINT) $(LINTFLAGS) -D__WINE__ $(OPTIONS) $(DIVINCL) $(X_CFLAGS) $$i; done
147 # Rule for html pages
150 for i in $(C_SRCS); do $(C2MAN) -L -o$(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) $$i; done
154 depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
155 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
158 $(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)
162 # End of global rules