Alexandre Julliard | 139a4b1 | 1996-11-02 14:24:07 +0000 | [diff] [blame] | 1 | # Global rules shared by all makefiles -*-Makefile-*- |
Alexandre Julliard | bf9130a | 1996-10-13 17:45:47 +0000 | [diff] [blame] | 2 | # |
| 3 | # Each individual makefile should define the following variables: |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 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 |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 8 | # C_SRCS : C sources for the module (optional) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 9 | # ASM_SRCS : assembly sources (optional) |
| 10 | # GEN_ASM_SRCS : generated assembly sources (optional) |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 11 | # RC_SRCS : resource source files (optional) |
Ulrich Weigand | 3dff7bb | 1999-07-11 13:58:31 +0000 | [diff] [blame] | 12 | # SPEC_SRCS : interface definition files (optional) |
| 13 | # GLUE : C sources for which glue code needs to be generated (optional) |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 14 | # EXTRA_SRCS : extra source files for make depend (optional) |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 15 | # EXTRA_OBJS : extra object files (optional) |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 16 | # WRCEXTRA : extra wrc flags (e.g. '-p _SysRes') (optional) |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 17 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 18 | # First some useful definitions |
| 19 | |
Alexandre Julliard | 8664b89 | 1996-04-05 14:58:24 +0000 | [diff] [blame] | 20 | SHELL = /bin/sh |
| 21 | CC = @CC@ |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 22 | CPP = @CPP@ |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 23 | CFLAGS = @CFLAGS@ |
Alexandre Julliard | 0623a6f | 1998-01-18 18:01:49 +0000 | [diff] [blame] | 24 | OPTIONS = @OPTIONS@ -D_REENTRANT |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 25 | X_CFLAGS = @X_CFLAGS@ |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 26 | X_LIBS = @X_LIBS@ |
Patrik Stridvall | ea58472 | 1998-11-01 16:22:07 +0000 | [diff] [blame] | 27 | XLIB = @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ |
Todd Vierling | 8beb15a | 1998-12-18 17:30:52 +0000 | [diff] [blame] | 28 | WINELIB = $(WINESTUB) -L$(TOPOBJDIR) -lwine |
Alexandre Julliard | 02e9008 | 1998-01-04 17:49:09 +0000 | [diff] [blame] | 29 | LIBS = @LIBS@ |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 30 | YACC = @YACC@ |
| 31 | LEX = @LEX@ |
| 32 | LEXLIB = @LEXLIB@ |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 33 | RANLIB = @RANLIB@ |
| 34 | LN_S = @LN_S@ |
Alexandre Julliard | 5166237 | 1999-05-15 10:41:15 +0000 | [diff] [blame] | 35 | DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 36 | ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS) |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 37 | LDCOMBINE = ld -r |
Todd Vierling | 4b992b0 | 1998-12-15 15:26:27 +0000 | [diff] [blame] | 38 | LDSHARED = @LDSHARED@ |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 39 | AR = ar rc |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 40 | RM = rm -f |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 41 | MV = mv |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 42 | MKDIR = mkdir -p |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 43 | C2MAN = @C2MAN@ |
James Juran | ffe6b76 | 1999-06-12 08:21:57 +0000 | [diff] [blame] | 44 | LDCONFIG = @LDCONFIG@ |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 45 | MANSPECS = -w $(TOPSRCDIR)/relay32/gdi32.spec \ |
| 46 | -w $(TOPSRCDIR)/relay32/user32.spec \ |
| 47 | -w $(TOPSRCDIR)/relay32/comctl32.spec \ |
| 48 | -w $(TOPSRCDIR)/relay32/comdlg32.spec \ |
| 49 | -w $(TOPSRCDIR)/relay32/kernel32.spec |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 50 | LINT = @LINT@ |
| 51 | LINTFLAGS = @LINTFLAGS@ |
| 52 | ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) |
Patrik Stridvall | 385dc18 | 1999-09-29 10:24:19 +0000 | [diff] [blame] | 53 | WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 54 | BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@ |
| 55 | MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@ |
| 56 | WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@ |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 57 | WRC = $(TOPOBJDIR)/tools/wrc/wrc@PROGEXT@ |
Bertho Stultiens | d1895a7 | 1999-04-25 18:31:35 +0000 | [diff] [blame] | 58 | WRCFLAGS = -c |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 59 | WINESTUB = $(TOPOBJDIR)/library/winestub.o |
Alexandre Julliard | 18f92e7 | 1996-07-17 20:02:21 +0000 | [diff] [blame] | 60 | SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)' |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 61 | @SET_MAKE@ |
| 62 | |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 63 | # Installation infos |
| 64 | |
| 65 | INSTALL = @INSTALL@ |
| 66 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 67 | INSTALL_DATA = @INSTALL_DATA@ |
| 68 | prefix = @prefix@ |
| 69 | exec_prefix = @exec_prefix@ |
| 70 | bindir = @bindir@ |
| 71 | libdir = @libdir@ |
| 72 | infodir = @infodir@ |
Alexandre Julliard | d6baf1b | 1999-07-18 15:47:22 +0000 | [diff] [blame] | 73 | mandir = @mandir@ |
| 74 | prog_manext = 1 |
| 75 | conf_manext = 5 |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 76 | includedir = @includedir@/wine |
| 77 | |
Ulrich Weigand | 3dff7bb | 1999-07-11 13:58:31 +0000 | [diff] [blame] | 78 | OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) \ |
| 79 | $(SPEC_SRCS:.spec=.spec.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS) |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 80 | |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 81 | LINTS = $(C_SRCS:.c=.ln) |
| 82 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 83 | # Implicit rules |
| 84 | |
Patrik Stridvall | 0691a59 | 1999-07-31 14:45:22 +0000 | [diff] [blame] | 85 | .SUFFIXES: |
Ulrich Weigand | 8336cc9 | 1999-08-15 12:45:53 +0000 | [diff] [blame] | 86 | .SUFFIXES: .rc .res .spec .spec.c .spec.o .glue.c $(SUFFIXES) |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 87 | |
| 88 | .c.o: |
| 89 | $(CC) -c $(ALLCFLAGS) -o $*.o $< |
| 90 | |
Patrik Stridvall | 0691a59 | 1999-07-31 14:45:22 +0000 | [diff] [blame] | 91 | .spec.c.spec.o: |
| 92 | $(CC) -c $(ALLCFLAGS) @GCC_NO_BUILTIN@ -o $*.spec.o $< |
| 93 | |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 94 | .s.o: |
Patrik Stridvall | 1439f72 | 1998-10-11 17:12:21 +0000 | [diff] [blame] | 95 | $(AS) -o $*.o $< |
Alexandre Julliard | 7e6ae4b | 1996-12-08 19:25:27 +0000 | [diff] [blame] | 96 | |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 97 | .S.o: |
| 98 | $(CC) -c -o $*.o $< |
| 99 | |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 100 | .rc.s: |
| 101 | $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $< |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 102 | |
| 103 | .rc.h: |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 104 | $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $< |
| 105 | |
| 106 | .rc.res: |
| 107 | $(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $< |
| 108 | |
| 109 | .res.s: |
| 110 | $(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $< |
| 111 | |
| 112 | .res.h: |
| 113 | $(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $< |
| 114 | |
Ulrich Weigand | 3dff7bb | 1999-07-11 13:58:31 +0000 | [diff] [blame] | 115 | .spec.spec.c: |
Ulrich Weigand | 4b32fd0 | 1999-07-15 14:51:40 +0000 | [diff] [blame] | 116 | $(BUILD) @BUILDFLAGS@ -o $@ -spec $< |
Ulrich Weigand | 3dff7bb | 1999-07-11 13:58:31 +0000 | [diff] [blame] | 117 | |
Ulrich Weigand | 8336cc9 | 1999-08-15 12:45:53 +0000 | [diff] [blame] | 118 | .c.glue.c: |
Ulrich Weigand | 4b32fd0 | 1999-07-15 14:51:40 +0000 | [diff] [blame] | 119 | $(BUILD) @BUILDFLAGS@ -o $@ -glue $< |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 120 | |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 121 | .c.ln: |
| 122 | $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 ) |
| 123 | |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 124 | # Rule to rebuild the resource compiler |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 125 | |
| 126 | $(WINERC) check_winerc: |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 127 | cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@ |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 128 | |
Alexandre Julliard | a845b88 | 1998-06-01 10:44:35 +0000 | [diff] [blame] | 129 | $(WRC) check_wrc: |
| 130 | cd $(TOPOBJDIR)/tools/wrc; $(SUBMAKE) wrc@PROGEXT@ |
| 131 | |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 132 | # Rule to rebuild the 'makedep' program |
Alexandre Julliard | 530ee84 | 1996-10-23 16:59:13 +0000 | [diff] [blame] | 133 | |
| 134 | $(MAKEDEP) check_makedep: |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 135 | cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@ |
| 136 | |
| 137 | # Rule to rebuild the 'build' program |
| 138 | |
| 139 | $(BUILD) checkbuild: |
| 140 | cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@ |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 141 | |
| 142 | # Rule for main module |
| 143 | |
Marcus Meissner | 9607512 | 1999-10-13 13:45:15 +0000 | [diff] [blame] | 144 | $(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 145 | $(LDCOMBINE) $(OBJS) -o $(MODULE).o |
| 146 | |
Alexandre Julliard | e66d421 | 1999-03-14 15:22:29 +0000 | [diff] [blame] | 147 | # Rules for makefile |
| 148 | |
Marcus Meissner | ca004e5 | 1999-01-03 12:26:22 +0000 | [diff] [blame] | 149 | Makefile: Makefile.in $(TOPSRCDIR)/configure |
| 150 | @echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure |
| 151 | @exit 1 |
| 152 | |
Alexandre Julliard | e66d421 | 1999-03-14 15:22:29 +0000 | [diff] [blame] | 153 | all: Makefile |
| 154 | |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 155 | # Rules for auto documentation |
Alexandre Julliard | 44ed71f | 1997-12-21 19:17:50 +0000 | [diff] [blame] | 156 | |
| 157 | man: $(C_SRCS) |
Alexandre Julliard | 829fe32 | 1998-07-26 14:27:39 +0000 | [diff] [blame] | 158 | for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done |
| 159 | |
| 160 | html: $(C_SRCS) |
| 161 | for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done |
| 162 | |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 163 | # Rule for linting |
| 164 | |
Patrik Stridvall | a9be64e | 1999-07-31 17:39:44 +0000 | [diff] [blame] | 165 | $(MODULE).ln : $(LINTS) |
| 166 | if test "$(LINTS)" ; \ |
| 167 | then \ |
| 168 | $(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \ |
| 169 | $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \ |
| 170 | else \ |
| 171 | $(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \ |
| 172 | fi |
| 173 | |
| 174 | lint:: $(MODULE).ln |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 175 | |
Patrik Stridvall | 385dc18 | 1999-09-29 10:24:19 +0000 | [diff] [blame] | 176 | # Rules for Windows API checking |
| 177 | |
| 178 | winapi_check:: |
| 179 | $(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) . |
| 180 | |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 181 | # Misc. rules |
| 182 | |
Ulrich Weigand | 3dff7bb | 1999-07-11 13:58:31 +0000 | [diff] [blame] | 183 | $(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h |
| 184 | |
Ulrich Weigand | 8336cc9 | 1999-08-15 12:45:53 +0000 | [diff] [blame] | 185 | $(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h $(TOPSRCDIR)/include/builtin32.h |
Ulrich Weigand | 3dff7bb | 1999-07-11 13:58:31 +0000 | [diff] [blame] | 186 | |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 187 | depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) |
| 188 | $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 189 | |
| 190 | clean:: |
Ulrich Weigand | 8336cc9 | 1999-08-15 12:45:53 +0000 | [diff] [blame] | 191 | $(RM) *.o *.ln \#*\# *~ *% .#* *.bak *.orig *.rej *.flc y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(SPEC_SRCS:.spec=.spec.c) $(GLUE:.c=.glue.c) $(PROGRAMS) |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 192 | |
Alexandre Julliard | ff8331e | 1995-09-18 11:19:54 +0000 | [diff] [blame] | 193 | dummy: |
Alexandre Julliard | d7d4fdf | 1995-12-26 15:05:24 +0000 | [diff] [blame] | 194 | |
| 195 | # End of global rules |