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.
30 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
33 BUILD = $(TOPOBJDIR)/tools/build
34 WINERC = $(TOPOBJDIR)/rc/winerc
35 SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
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:%=./%)
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
72 # Rule for main module
75 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
80 depend:: $(C_SRCS) $(GEN_C_SRCS)
81 sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
82 $(CC) $(ALLCFLAGS) -MM $(DEPEND_SRCS) >> tmp_make
86 $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc tmp_make winerctmp.c $(GEN_C_SRCS)