Release 970824
[wine.git] / Make.rules.in
blobf6373079cc325881903698c9596caf06940b822e
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 # GEN_C_SRCS   : generated C sources (optional)
10 # ASM_SRCS     : assembly sources (optional)
11 # GEN_ASM_SRCS : generated assembly sources (optional)
12 # EXTRA_OBJS   : extra object files (optional)
14 # First some useful definitions
16 SHELL     = /bin/sh
17 CC        = @CC@
18 CPP       = @CPP@
19 CFLAGS    = @CFLAGS@
20 OPTIONS   = @OPTIONS@
21 X_CFLAGS  = @X_CFLAGS@
22 X_LIBS    = @X_LIBS@
23 XPM_LIB   = -lXpm
24 XLIB      = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
25 WINELIB   = $(WINESTUB) $(TOPOBJDIR)/@MAIN_TARGET@
26 LDLIBS    = @LDLIBS@
27 YACC      = @YACC@
28 LEX       = @LEX@
29 LEXLIB    = @LEXLIB@
30 RANLIB    = @RANLIB@
31 LN_S      = @LN_S@
32 DIVINCL   = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
33 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
34 LDCOMBINE = ld -r
35 AR        = ar rc
36 RM        = rm -f
37 MKDIR     = mkdir
38 BUILD     = $(TOPOBJDIR)/tools/build@PROGEXT@
39 MAKEDEP   = $(TOPOBJDIR)/tools/makedep@PROGEXT@
40 WINERC    = $(TOPOBJDIR)/rc/winerc@PROGEXT@
41 WINESTUB  = $(TOPOBJDIR)/library/winestub.o
42 SUBMAKE   = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
43 @SET_MAKE@
45 # Installation infos
47 INSTALL         = @INSTALL@
48 INSTALL_PROGRAM = @INSTALL_PROGRAM@
49 INSTALL_DATA    = @INSTALL_DATA@
50 prefix          = @prefix@
51 exec_prefix     = @exec_prefix@
52 bindir          = @bindir@
53 libdir          = @libdir@
54 infodir         = @infodir@
55 mandir          = @mandir@/man1
56 manext          = .1
57 includedir      = @includedir@/wine
59 OBJS = $(GEN_C_SRCS:.c=.o) $(C_SRCS:.c=.o) \
60        $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
62 # Implicit rules
64 .SUFFIXES: .rc
66 .c.o:
67         $(CC) -c $(ALLCFLAGS) -o $*.o $<
69 .s.o:
70         $(CC) -c -o $*.o $<  
72 .S.o:
73         $(CC) -c -o $*.o $<  
75 .rc.c:
76         echo "#include \"windows.h\"" >winerctmp.c
77         echo WINDOWS_H_ENDS_HERE >>winerctmp.c
78         cat $< >>winerctmp.c
79         $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
80         $(RM) winerctmp.c
82 .rc.h:
83         echo "#include \"windows.h\"" >winerctmp.c
84         echo WINDOWS_H_ENDS_HERE >>winerctmp.c
85         cat $< >>winerctmp.c
86         $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
87         $(RM) winerctmp.c
90 # Rule to rebuild resource compiler
92 $(WINERC) check_winerc:
93         cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
95 # Rule to rebuild the 'makedep' program
97 $(MAKEDEP) check_makedep:
98         cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
100 # Rule to rebuild the 'build' program
102 $(BUILD) checkbuild:
103         cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
105 # Rule for main module
107 $(MODULE).o: $(OBJS)
108         $(LDCOMBINE) $(OBJS) -o $(MODULE).o
111 # Misc. rules
113 depend:: $(MAKEDEP) $(C_SRCS) $(GEN_C_SRCS)
114         $(MAKEDEP) $(DIVINCL) -C. $(GEN_C_SRCS) -C$(SRCDIR) $(C_SRCS)
116 clean::
117         $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc winerctmp.c core $(GEN_C_SRCS) $(GEN_C_SRCS:.c=.h) $(GEN_ASM_SRCS) $(PROGRAMS)
119 dummy:
121 # End of global rules