Changed the Wine internal cdrom interface to the NT model.
[wine/dibdrv.git] / Make.rules.in
blob878923bc58270e57d785377292b2e5b84f5ca017
1 # Global rules shared by all makefiles     -*-Makefile-*-
3 # Each individual makefile must 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
9 # Each individual makefile may define the following additional variables:
10 # C_SRCS       : C sources for the module
11 # ASM_SRCS     : assembly sources
12 # GEN_C_SRCS   : generated C files
13 # GEN_ASM_SRCS : generated assembly sources
14 # RC_SRCS      : resource source files
15 # SPEC_SRCS    : interface definition files
16 # GLUE         : C sources for which glue code needs to be generated
17 # EXTRA_SRCS   : extra source files for make depend
18 # EXTRA_OBJS   : extra object files
19 # SUBDIRS      : subdirectories that contain a Makefile
20 # EXTRASUBDIRS : subdirectories that do not contain a Makefile
21 # PLTESTS      : Perl test scripts
22 # CTESTS       : C test sources
24 # First some useful definitions
26 SHELL     = /bin/sh
27 CC        = @CC@
28 CPP       = @CPP@
29 CFLAGS    = @CFLAGS@
30 OPTIONS   = @OPTIONS@ -D_REENTRANT
31 X_CFLAGS  = @X_CFLAGS@
32 X_LIBS    = @X_LIBS@
33 XLIB      = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
34 LIBS      = @LIBS@
35 YACC      = @YACC@
36 LEX       = @LEX@
37 LEXLIB    = @LEXLIB@
38 LIBEXT    = @LIBEXT@
39 LDSHARED  = @LDSHARED@
40 DLLWRAP   = @DLLWRAP@
41 DLLWRAPFLAGS = --add-stdcall-alias
42 RANLIB    = @RANLIB@
43 LN_S      = @LN_S@
44 DIVINCL   = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
45 ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
46 LDCOMBINE = @LDCOMBINE@
47 LDFLAGS   = @LDFLAGS@
48 AR        = ar rc
49 RM        = rm -f
50 MV        = mv
51 MKDIR     = mkdir -p
52 C2MAN     = @C2MAN@
53 MANSPECS  = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
54             -w $(TOPSRCDIR)/dlls/user/user32.spec \
55             -w $(TOPSRCDIR)/dlls/comctl32/comctl32.spec \
56             -w $(TOPSRCDIR)/dlls/commdlg/comdlg32.spec \
57             -w $(TOPSRCDIR)/dlls/kernel/kernel32.spec 
58 LINT      = @LINT@
59 LINTFLAGS = @LINTFLAGS@
60 ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
61 WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
62 WINETEST     = $(TOPOBJDIR)/programs/winetest/winetest
63 RUNTEST      = $(TOPSRCDIR)/programs/winetest/runtest
64 TESTRESULTS  = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok)
65 WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
66 MAKEDEP   = $(TOPOBJDIR)/tools/makedep
67 WRC       = $(TOPOBJDIR)/tools/wrc/wrc
68 WMC       = $(TOPOBJDIR)/tools/wmc/wmc
69 LDPATH    = @LDPATH@
70 DLLDIR    = $(TOPOBJDIR)/dlls
71 LIBWINE   = -L$(TOPOBJDIR)/library -lwine
72 LIBTSX11  = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
73 LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
74 LIBUUID   = -L$(TOPOBJDIR)/ole -lwine_uuid
76 @SET_MAKE@
78 # Installation infos
80 INSTALL         = @INSTALL@
81 INSTALL_PROGRAM = @INSTALL_PROGRAM@
82 INSTALL_SCRIPT  = @INSTALL_SCRIPT@
83 INSTALL_DATA    = @INSTALL_DATA@
84 prefix          = @prefix@
85 exec_prefix     = @exec_prefix@
86 bindir          = @bindir@
87 libdir          = @libdir@
88 infodir         = @infodir@
89 mandir          = @mandir@
90 prog_manext     = 1
91 conf_manext     = 5
92 includedir      = @includedir@/wine
93 CLEAN_FILES     = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
94                   *.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
96 OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
97        $(ASM_SRCS:.S=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
99 LINTS = $(C_SRCS:.c=.ln)
101 # Implicit rules
103 .SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .glue.c .pl .ok
105 .c.o:
106         $(CC) -c $(ALLCFLAGS) -o $@ $<
108 .s.o:
109         $(AS) -o $@ $<
111 .S.o:
112         $(CC) -c -o $@ $<
114 .mc.mc.rc:
115         $(LDPATH) $(WMC) -i -H /dev/null -o $@ $<
117 .rc.res:
118         $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
120 .spec.spec.c:
121         $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -spec $<
123 .c.glue.c:
124         $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
126 .c.ln:
127         $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
129 .pl.ok:
130         $(RUNTEST) $(TOPOBJDIR) $< $(RUNTESTFLAGS) && touch $@
132 .PHONY: all install uninstall clean distclean depend dummy test testclean
134 # 'all' target first in case the enclosing Makefile didn't define any target
136 all: Makefile
138 filter:
139         @$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
141 # Rule for main module intermediate object
143 $(MODULE).tmp.o: $(OBJS) Makefile.in
144         $(LDCOMBINE) $(OBJS) -o $@
145         -strip --strip-unneeded $@
147 # Rule for main module spec file
149 $(MODULE).spec.c: $(MODULE).spec $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
150         $(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) $(SYMBOLFILE:%=-sym %) -o $@ -spec $(SRCDIR)/$(MODULE).spec
152 # Rule to rebuild the resource compiler
154 $(WRC):
155         cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
157 # Rule to rebuild the message compiler
159 $(WMC):
160         cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
162 # Rule to rebuild the 'makedep' program
164 $(MAKEDEP):
165         cd $(TOPOBJDIR)/tools && $(MAKE) makedep
167 # Rule to rebuild the 'winebuild' program
169 $(WINEBUILD):
170         cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
172 # Rules for makefile
174 Makefile: Makefile.in $(TOPSRCDIR)/configure
175         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
176         @exit 1
178 # Rules for auto documentation
180 $(SUBDIRS:%=%/__man__): dummy
181         cd `dirname $@` && $(MAKE) man
183 man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
184         if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
186 $(SUBDIRS:%=%/__doc_html__): dummy
187         cd `dirname $@` && $(MAKE) doc-html
189 doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
190         if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(TOPOBJDIR)/documentation/html; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
192 # Rule for linting
194 $(MODULE).ln : $(LINTS)
195         if test "$(LINTS)" ; \
196         then \
197                 $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
198                 $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
199         else \
200                 $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
201         fi
203 lint:: $(MODULE).ln
205 # Rules for Windows API checking
207 winapi_check::
208         $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
210 # Rules for dependencies
212 $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
213         cd `dirname $@` && $(MAKE) depend
215 depend: $(MAKEDEP) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
216         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
218 # Rules for cleaning
220 $(SUBDIRS:%=%/__clean__): dummy
221         cd `dirname $@` && $(MAKE) clean
223 $(SUBDIRS:%=%/__testclean__): dummy
224         cd `dirname $@` && $(MAKE) testclean
226 $(EXTRASUBDIRS:%=%/__clean__): dummy
227         -cd `dirname $@` && $(RM) $(CLEAN_FILES)
229 testclean:: $(SUBDIRS:%=%/__testclean__)
230         $(RM) $(TESTRESULTS)
232 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
233         $(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(TESTRESULTS) $(PROGRAMS)
235 # Rules for installing
237 $(SUBDIRS:%=%/__install__): dummy
238         cd `dirname $@` && $(MAKE) install
240 $(SUBDIRS:%=%/__uninstall__): dummy
241         cd `dirname $@` && $(MAKE) uninstall
243 # Rules for testing
245 test:: $(TESTRESULTS)
247 $(TESTRESULTS): $(WINETEST)
249 $(WINETEST):
250         cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest
252 # Misc. rules
254 $(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
256 $(GLUE:.c=.glue.c): $(WINEBUILD)
258 $(RC_SRCS:.rc=.res): $(WRC)
260 $(RC_SRCS16:.rc=.res): $(WRC)
262 $(MC_SRCS:.mc=.mc.rc): $(WMC)
264 $(SUBDIRS): dummy
265         @cd $@ && $(MAKE)
267 dummy:
269 # End of global rules