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 # ASM_SRCS : assembly sources (optional)
10 # GEN_ASM_SRCS : generated assembly sources (optional)
11 # RC_SRCS : resource source files (optional)
12 # EXTRA_SRCS : extra source files for make depend (optional)
13 # EXTRA_OBJS : extra object files (optional)
15 # First some useful definitions
21 OPTIONS = @OPTIONS@ -D_REENTRANT
25 XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
26 WINELIB = $(WINESTUB) $(TOPOBJDIR)/@LIB_TARGET@
33 DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
34 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
40 BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
41 MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
42 WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
43 WINESTUB = $(TOPOBJDIR)/library/winestub.o
44 SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
50 INSTALL_PROGRAM = @INSTALL_PROGRAM@
51 INSTALL_DATA = @INSTALL_DATA@
53 exec_prefix = @exec_prefix@
57 mandir = @mandir@/man1
59 includedir = @includedir@/wine
61 OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) \
62 $(RC_SRCS:.rc=.o) $(EXTRA_OBJS)
69 $(CC) -c $(ALLCFLAGS) -o $*.o $<
78 echo "#include \"windows.h\"" >$*-tmp.c
79 echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
81 $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
85 echo "#include \"windows.h\"" >$*-tmp.c
86 echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
88 $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
92 # Rule to rebuild resource compiler
94 $(WINERC) check_winerc:
95 cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
97 # Rule to rebuild the 'makedep' program
99 $(MAKEDEP) check_makedep:
100 cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
102 # Rule to rebuild the 'build' program
105 cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
107 # Rule for main module
110 $(LDCOMBINE) $(OBJS) -o $(MODULE).o
115 for i in $(C_SRCS); do $(C2MAN) -L -o$(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) $$i; done
119 depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
120 $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
123 $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc *-tmp.c y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.c) $(RC_SRCS:.rc=.h) $(PROGRAMS)
127 # End of global rules