Murali Pattathe
[wine/multimedia.git] / Make.rules.in
bloba90115a0f477ff60d515ce6219cdc05affe12154
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 # SPEC_SRCS    : interface definition files (optional)
13 # GLUE         : C sources for which glue code needs to be generated (optional)
14 # EXTRA_SRCS   : extra source files for make depend (optional)
15 # EXTRA_OBJS   : extra object files (optional)
16 # WRCEXTRA     : extra wrc flags (e.g. '-p _SysRes') (optional)
18 # First some useful definitions
20 SHELL     = /bin/sh
21 CC        = @CC@
22 CPP       = @CPP@
23 CFLAGS    = @CFLAGS@
24 OPTIONS   = @OPTIONS@ -D_REENTRANT
25 X_CFLAGS  = @X_CFLAGS@
26 X_LIBS    = @X_LIBS@
27 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
28 WINELIB   = $(WINESTUB) -L$(TOPOBJDIR) -lwine
29 LIBS      = @LIBS@
30 YACC      = @YACC@
31 LEX       = @LEX@
32 LEXLIB    = @LEXLIB@
33 RANLIB    = @RANLIB@
34 LN_S      = @LN_S@
35 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include
36 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
37 LDCOMBINE = ld -r
38 LDSHARED  = @LDSHARED@
39 AR        = ar rc
40 RM        = rm -f
41 MV        = mv
42 MKDIR     = mkdir -p
43 C2MAN     = @C2MAN@
44 LDCONFIG  = @LDCONFIG@
45 MANSPECS  = -w $(TOPSRCDIR)/relay32/gdi32.spec \
46             -w $(TOPSRCDIR)/relay32/user32.spec \
47             -w $(TOPSRCDIR)/relay32/comctl32.spec \
48             -w $(TOPSRCDIR)/relay32/comdlg32.spec \
49             -w $(TOPSRCDIR)/relay32/kernel32.spec 
50 LINT      = @LINT@
51 LINTFLAGS = @LINTFLAGS@
52 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
53 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
54 BUILD     = $(TOPOBJDIR)/tools/build@PROGEXT@
55 MAKEDEP   = $(TOPOBJDIR)/tools/makedep@PROGEXT@
56 WINERC    = $(TOPOBJDIR)/rc/winerc@PROGEXT@
57 WRC       = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
58 WRCFLAGS  = -c
59 WINESTUB  = $(TOPOBJDIR)/library/winestub.o
60 SUBMAKE   = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
61 @SET_MAKE@
63 # Installation infos
65 INSTALL         = @INSTALL@
66 INSTALL_PROGRAM = @INSTALL_PROGRAM@
67 INSTALL_DATA    = @INSTALL_DATA@
68 prefix          = @prefix@
69 exec_prefix     = @exec_prefix@
70 bindir          = @bindir@
71 libdir          = @libdir@
72 infodir         = @infodir@
73 mandir          = @mandir@
74 prog_manext     = 1
75 conf_manext     = 5
76 includedir      = @includedir@/wine
78 OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) \
79        $(SPEC_SRCS:.spec=.spec.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
81 LINTS = $(C_SRCS:.c=.ln)
83 # Implicit rules
85 .SUFFIXES:
86 .SUFFIXES: .rc .res .spec .spec.c .spec.o .glue.c $(SUFFIXES)
88 .c.o:
89         $(CC) -c $(ALLCFLAGS) -o $*.o $<
91 .spec.c.spec.o:
92         $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $<
94 .s.o:
95         $(AS) -o $*.o $<  
97 .S.o:
98         $(CC) -c -o $*.o $<  
100 .rc.s:
101         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
103 .rc.h:
104         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
106 .rc.res:
107         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
109 .res.s:
110         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
112 .res.h:
113         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
115 .spec.spec.c:
116         $(BUILD) @BUILDFLAGS@ -o $@ -spec $<
118 .c.glue.c:
119         $(BUILD) @BUILDFLAGS@ -o $@ -glue $<
121 .c.ln:
122         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
124 # Rule to rebuild the resource compiler
126 $(WINERC) check_winerc:
127         cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
129 $(WRC) check_wrc:
130         cd $(TOPOBJDIR)/tools/wrc; $(SUBMAKE) wrc@PROGEXT@
132 # Rule to rebuild the 'makedep' program
134 $(MAKEDEP) check_makedep:
135         cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
137 # Rule to rebuild the 'build' program
139 $(BUILD) checkbuild:
140         cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
142 # Rule to rebuild winestub.o
144 $(WINESTUB) check_winestub:
145         cd $(TOPOBJDIR)/library; $(SUBMAKE) winestub.o
147 # Rule for main module
149 $(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
150         $(LDCOMBINE) $(OBJS) -o $(MODULE).o
152 # Rules for makefile
154 Makefile: Makefile.in $(TOPSRCDIR)/configure
155         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
156         @exit 1
158 all: Makefile
160 # Rules for auto documentation
162 man: $(C_SRCS)
163         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
165 html: $(C_SRCS)
166         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
168 # Rule for linting
170 $(MODULE).ln : $(LINTS)
171         if test "$(LINTS)" ; \
172         then \
173                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
174                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
175         else \
176                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
177         fi
179 lint:: $(MODULE).ln
181 # Rules for Windows API checking
183 winapi_check::
184         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
186 # Misc. rules
188 $(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
190 $(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
192 depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
193         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
195 clean::
196         $(RM) *.o *.ln \#*\# *~ *% .#* *.bak *.orig *.rej *.flc y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(SPEC_SRCS:.spec=.spec.c) $(GLUE:.c=.glue.c) $(PROGRAMS)
198 dummy:
200 # End of global rules