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
23 XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
24 WINELIB = -L$(TOPOBJDIR) -lwine
29 DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
30 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
33 BUILD = $(TOPOBJDIR)/tools/build
34 MAKEDEP = $(TOPOBJDIR)/tools/makedep
35 WINERC = $(TOPOBJDIR)/rc/winerc
36 SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
39 OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
46 $(CC) -c $(ALLCFLAGS) -o $*.o $<
52 echo "#include \"windows.h\"" >winerctmp.c
53 echo WINDOWS_H_ENDS_HERE >>winerctmp.c
55 $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
59 echo "#include \"windows.h\"" >winerctmp.c
60 echo WINDOWS_H_ENDS_HERE >>winerctmp.c
62 $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
66 # Rule to rebuild resource compiler
68 $(WINERC) check_winerc:
69 cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc
71 # Rule to rebuild the makedep program
73 $(MAKEDEP) check_makedep:
74 cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep
76 # Rule for main module
79 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
84 depend:: $(MAKEDEP) $(C_SRCS) $(GEN_C_SRCS)
85 $(MAKEDEP) $(DIVINCL) -C. $(GEN_C_SRCS) -C$(SRCDIR) $(C_SRCS)
88 $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc winerctmp.c $(GEN_C_SRCS) $(GEN_C_SRCS:.c=.h) $(PROGRAMS)