Authors: James Juran <jrj120@psu.edu>, Andreas Mohr <cipam895@cip1.ind.uni-stuttgart.de>
[wine/multimedia.git] / Make.rules.in
blob0b4fbd1610a272363c1d165ce6ecc2fedf919b54
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 MKDIR     = mkdir -p
42 C2MAN     = @C2MAN@
43 LDCONFIG  = @LDCONFIG@
44 MANSPECS  = -w $(TOPSRCDIR)/relay32/gdi32.spec \
45             -w $(TOPSRCDIR)/relay32/user32.spec \
46             -w $(TOPSRCDIR)/relay32/comctl32.spec \
47             -w $(TOPSRCDIR)/relay32/comdlg32.spec \
48             -w $(TOPSRCDIR)/relay32/kernel32.spec 
49 LINT      = lclint
50 LINTFLAGS = +posixlib +gnuextensions +trytorecover
51 BUILD     = $(TOPOBJDIR)/tools/build@PROGEXT@
52 MAKEDEP   = $(TOPOBJDIR)/tools/makedep@PROGEXT@
53 WINERC    = $(TOPOBJDIR)/rc/winerc@PROGEXT@
54 WRC       = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@
55 WRCFLAGS  = -c
56 WINESTUB  = $(TOPOBJDIR)/library/winestub.o
57 SUBMAKE   = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
58 @SET_MAKE@
60 # Installation infos
62 INSTALL         = @INSTALL@
63 INSTALL_PROGRAM = @INSTALL_PROGRAM@
64 INSTALL_DATA    = @INSTALL_DATA@
65 prefix          = @prefix@
66 exec_prefix     = @exec_prefix@
67 bindir          = @bindir@
68 libdir          = @libdir@
69 infodir         = @infodir@
70 mandir          = @mandir@
71 prog_manext     = 1
72 conf_manext     = 5
73 includedir      = @includedir@/wine
75 OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) \
76        $(SPEC_SRCS:.spec=.spec.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
78 # Implicit rules
80 .SUFFIXES: .rc .res .spec .spec.c .glue.s
82 .c.o:
83         $(CC) -c $(ALLCFLAGS) -o $*.o $<
85 .s.o:
86         $(AS) -o $*.o $<  
88 .S.o:
89         $(CC) -c -o $*.o $<  
91 .rc.s:
92         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
94 .rc.h:
95         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
97 .rc.res:
98         $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
100 .res.s:
101         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
103 .res.h:
104         $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
106 .spec.spec.c:
107         $(BUILD) @BUILDFLAGS@ -o $@ -spec $<
109 .c.glue.s:
110         $(BUILD) @BUILDFLAGS@ -o $@ -glue $<
112 # Rule to rebuild the resource compiler
114 $(WINERC) check_winerc:
115         cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
117 $(WRC) check_wrc:
118         cd $(TOPOBJDIR)/tools/wrc; $(SUBMAKE) wrc@PROGEXT@
120 # Rule to rebuild the 'makedep' program
122 $(MAKEDEP) check_makedep:
123         cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
125 # Rule to rebuild the 'build' program
127 $(BUILD) checkbuild:
128         cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
130 # Rule for main module
132 $(MODULE).o: $(OBJS)
133         $(LDCOMBINE) $(OBJS) -o $(MODULE).o
135 # Rules for makefile
137 Makefile: Makefile.in $(TOPSRCDIR)/configure
138         @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
139         @exit 1
141 all: Makefile
143 # Rules for auto documentation
145 man: $(C_SRCS)
146         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
148 html: $(C_SRCS)
149         for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h  $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done
151 # Rule for linting
153 lint:
154         for i in $(C_SRCS); do $(LINT) $(LINTFLAGS) -D__WINE__ $(OPTIONS) $(DIVINCL) $(X_CFLAGS) $$i; done
156 # Misc. rules
158 $(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h
160 $(GLUE:.c=.glue.s): $(BUILD)
162 depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
163         $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
165 clean::
166         $(RM) *.o \#*\# *~ *% .#* *.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.s) $(PROGRAMS)
168 dummy:
170 # End of global rules