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
24 XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
25 WINELIB = $(WINESTUB) $(TOPOBJDIR)/@MAIN_TARGET@
32 DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
33 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
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)'
48 INSTALL_PROGRAM = @INSTALL_PROGRAM@
49 INSTALL_DATA = @INSTALL_DATA@
51 exec_prefix = @exec_prefix@
55 mandir = @mandir@/man1
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)
67 $(CC) -c $(ALLCFLAGS) -o $*.o $<
76 echo "#include \"windows.h\"" >winerctmp.c
77 echo WINDOWS_H_ENDS_HERE >>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 $*
83 echo "#include \"windows.h\"" >winerctmp.c
84 echo WINDOWS_H_ENDS_HERE >>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 $*
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
103 cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
105 # Rule for main module
108 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
113 depend:: $(MAKEDEP) $(C_SRCS) $(GEN_C_SRCS)
114 $(MAKEDEP) $(DIVINCL) -C. $(GEN_C_SRCS) -C$(SRCDIR) $(C_SRCS)
117 $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc winerctmp.c core $(GEN_C_SRCS) $(GEN_C_SRCS:.c=.h) $(GEN_ASM_SRCS) $(PROGRAMS)
121 # End of global rules