Release 961013
[wine/multimedia.git] / Make.rules.in
blob06455e142e97c58a7f331771f829734211593d23
1 # Global rules shared by all makefiles
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
9 # GEN_C_SRCS : generated C sources (optional)
10 # ASM_SRCS   : assembly sources (optional)
11 # EXTRA_OBJS : extra object files (optional)
13 # First some useful definitions
15 SHELL     = /bin/sh
16 CC        = @CC@
17 CPP       = @CPP@
18 CFLAGS    = @CFLAGS@
19 OPTIONS   = @OPTIONS@
20 X_CFLAGS  = @X_CFLAGS@
21 X_LIBS    = @X_LIBS@
22 XPM_LIB   = -lXpm
23 XLIB      = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
24 WINELIB   = -L$(TOPOBJDIR) -lwine
25 LDLIBS    = @LDLIBS@
26 YACC      = @YACC@
27 LEX       = @LEX@
28 LEXLIB    = @LEXLIB@
29 DIVINCL   = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I.
30 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
31 LDCOMBINE = ld -r
32 RM        = rm -f
33 BUILD     = $(TOPOBJDIR)/tools/build
34 WINERC    = $(TOPOBJDIR)/rc/winerc
35 SUBMAKE   = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
36 @SET_MAKE@
38 OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
39 DEPEND_SRCS = $(C_SRCS:%=$(SRCDIR)/%) $(GEN_C_SRCS:%=./%)
41 # Implicit rules
43 .SUFFIXES: .rc
45 .c.o:
46         $(CC) -c $(ALLCFLAGS) -o $*.o $<
48 .S.o:
49         $(CC) -c -o $*.o $<  
51 .rc.c:
52         echo "#include \"windows.h\"" >winerctmp.c
53         echo WINDOWS_H_ENDS_HERE >>winerctmp.c
54         cat $< >>winerctmp.c
55         $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
56         $(RM) winerctmp.c
58 .rc.h:
59         echo "#include \"windows.h\"" >winerctmp.c
60         echo WINDOWS_H_ENDS_HERE >>winerctmp.c
61         cat $< >>winerctmp.c
62         $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
63         $(RM) winerctmp.c
66 # Rule to rebuild resource compiler
68 $(WINERC) check_winerc:
69         cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc
72 # Rule for main module
74 $(MODULE).o: $(OBJS)
75         $(LDCOMBINE) $(OBJS) -o $(MODULE).o
78 # Misc. rules
80 depend:: $(C_SRCS) $(GEN_C_SRCS)
81         sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
82         $(CC) $(ALLCFLAGS) -MM $(DEPEND_SRCS) >> tmp_make
83         mv tmp_make Makefile
85 clean::
86         $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc tmp_make winerctmp.c $(GEN_C_SRCS)
88 dummy:
90 # End of global rules