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
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@
30 DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
31 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
34 BUILD = $(TOPOBJDIR)/tools/build
35 MAKEDEP = $(TOPOBJDIR)/tools/makedep
36 WINERC = $(TOPOBJDIR)/rc/winerc
37 WINESTUB = $(TOPOBJDIR)/library/winestub.o
38 SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
41 OBJS = $(GEN_C_SRCS:.c=.o) $(C_SRCS:.c=.o) \
42 $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
49 $(CC) -c $(ALLCFLAGS) -o $*.o $<
58 echo "#include \"windows.h\"" >winerctmp.c
59 echo WINDOWS_H_ENDS_HERE >>winerctmp.c
61 $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
65 echo "#include \"windows.h\"" >winerctmp.c
66 echo WINDOWS_H_ENDS_HERE >>winerctmp.c
68 $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
72 # Rule to rebuild resource compiler
74 $(WINERC) check_winerc:
75 cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc
77 # Rule to rebuild the makedep program
79 $(MAKEDEP) check_makedep:
80 cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep
82 # Rule for main module
85 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
90 depend:: $(MAKEDEP) $(C_SRCS) $(GEN_C_SRCS)
91 $(MAKEDEP) $(DIVINCL) -C. $(GEN_C_SRCS) -C$(SRCDIR) $(C_SRCS)
94 $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc winerctmp.c $(GEN_C_SRCS) $(GEN_C_SRCS:.c=.h) $(GEN_ASM_SRCS) $(PROGRAMS)