[18214] | 1 | # Makefile for libxslt, specific for Windows, GCC (mingw) and GNU make. |
---|
| 2 | # |
---|
| 3 | # Take a look at the beginning and modify the variables to suit your |
---|
| 4 | # environment. Having done that, you can do a |
---|
| 5 | # |
---|
[20732] | 6 | # make [all] to build the libxslt and the accompanying utilities. |
---|
| 7 | # make clean to remove all compiler output files and return to a |
---|
| 8 | # clean state. |
---|
| 9 | # make rebuild to rebuild everything from scratch. This basically does |
---|
| 10 | # a 'make clean' and then a 'make all'. |
---|
| 11 | # make install to install the library and its header files. |
---|
[18214] | 12 | # |
---|
[18542] | 13 | # November 2002, Igor Zlatkovic <igor@zlatkovic.com> |
---|
[18214] | 14 | |
---|
| 15 | AUTOCONF = .\config.mingw |
---|
| 16 | include $(AUTOCONF) |
---|
| 17 | |
---|
| 18 | # There should never be a need to modify anything below this line. |
---|
| 19 | # ---------------------------------------------------------------- |
---|
| 20 | |
---|
[20732] | 21 | BASEDIR = .. |
---|
| 22 | XSLT_SRCDIR = $(BASEDIR)\libxslt |
---|
| 23 | EXSLT_SRCDIR = $(BASEDIR)\libexslt |
---|
| 24 | UTILS_SRCDIR = $(BASEDIR)\xsltproc |
---|
| 25 | BINDIR = bin.mingw |
---|
[18214] | 26 | |
---|
| 27 | # Names of various input and output components. |
---|
| 28 | XSLT_NAME = xslt |
---|
| 29 | XSLT_BASENAME = lib$(XSLT_NAME) |
---|
| 30 | XSLT_SO = $(XSLT_BASENAME).dll |
---|
| 31 | XSLT_IMP = $(XSLT_BASENAME).lib |
---|
| 32 | XSLT_A = $(XSLT_BASENAME).a |
---|
| 33 | EXSLT_NAME = exslt |
---|
| 34 | EXSLT_BASENAME = lib$(EXSLT_NAME) |
---|
| 35 | EXSLT_SO = $(EXSLT_BASENAME).dll |
---|
| 36 | EXSLT_IMP = $(EXSLT_BASENAME).lib |
---|
| 37 | EXSLT_A = $(EXSLT_BASENAME).a |
---|
| 38 | |
---|
| 39 | # Places where intermediate files produced by the compiler go |
---|
[20732] | 40 | XSLT_INTDIR = int.xslt.mingw |
---|
| 41 | XSLT_INTDIR_A = int.xslta.mingw |
---|
| 42 | EXSLT_INTDIR = int.exslt.mingw |
---|
| 43 | EXSLT_INTDIR_A = int.exslta.mingw |
---|
| 44 | UTILS_INTDIR = int.utils.mingw |
---|
[18214] | 45 | |
---|
| 46 | # The preprocessor and its options. |
---|
| 47 | CPP = gcc.exe -E |
---|
| 48 | CPPFLAGS += |
---|
| 49 | |
---|
| 50 | # The compiler and its options. |
---|
| 51 | CC = gcc.exe |
---|
| 52 | CFLAGS += -DWIN32 -D_WINDOWS -D_MBCS |
---|
| 53 | CFLAGS += -I$(BASEDIR) -I$(XSLT_SRCDIR) -I$(INCPREFIX) |
---|
| 54 | |
---|
| 55 | # The linker and its options. |
---|
| 56 | LD = gcc.exe |
---|
| 57 | LDFLAGS += -Wl,-L,$(BINDIR) -Wl,-L,$(LIBPREFIX) |
---|
| 58 | LIBS = -lwsock32 |
---|
| 59 | |
---|
| 60 | # The archiver and its options. |
---|
| 61 | AR = ar.exe |
---|
| 62 | ARFLAGS = -r |
---|
| 63 | |
---|
| 64 | # Optimisation and debug symbols. |
---|
| 65 | ifeq ($(DEBUG),1) |
---|
| 66 | CFLAGS += -D_DEBUG -g |
---|
| 67 | LDFLAGS += |
---|
| 68 | else |
---|
| 69 | CFLAGS += -DNDEBUG -O2 |
---|
| 70 | LDFLAGS += |
---|
| 71 | endif |
---|
| 72 | |
---|
| 73 | # Libxslt object files. |
---|
| 74 | XSLT_OBJS = $(XSLT_INTDIR)/attributes.o\ |
---|
| 75 | $(XSLT_INTDIR)/documents.o\ |
---|
| 76 | $(XSLT_INTDIR)/extensions.o\ |
---|
| 77 | $(XSLT_INTDIR)/extra.o\ |
---|
| 78 | $(XSLT_INTDIR)/functions.o\ |
---|
| 79 | $(XSLT_INTDIR)/imports.o\ |
---|
| 80 | $(XSLT_INTDIR)/keys.o\ |
---|
| 81 | $(XSLT_INTDIR)/namespaces.o\ |
---|
| 82 | $(XSLT_INTDIR)/numbers.o\ |
---|
| 83 | $(XSLT_INTDIR)/pattern.o\ |
---|
| 84 | $(XSLT_INTDIR)/preproc.o\ |
---|
| 85 | $(XSLT_INTDIR)/security.o\ |
---|
| 86 | $(XSLT_INTDIR)/templates.o\ |
---|
| 87 | $(XSLT_INTDIR)/transform.o\ |
---|
| 88 | $(XSLT_INTDIR)/variables.o\ |
---|
| 89 | $(XSLT_INTDIR)/xslt.o\ |
---|
| 90 | $(XSLT_INTDIR)/xsltutils.o |
---|
[20732] | 91 | XSLT_SRCS = $(subst .o,.c,$(subst $(XSLT_INTDIR),$(XSLT_SRCDIR),$(XSLT_OBJS))) |
---|
[18214] | 92 | |
---|
| 93 | # Static libxslt object files. |
---|
| 94 | XSLT_OBJS_A = $(XSLT_INTDIR_A)/attributes.o\ |
---|
| 95 | $(XSLT_INTDIR_A)/documents.o\ |
---|
| 96 | $(XSLT_INTDIR_A)/extensions.o\ |
---|
| 97 | $(XSLT_INTDIR_A)/extra.o\ |
---|
| 98 | $(XSLT_INTDIR_A)/functions.o\ |
---|
| 99 | $(XSLT_INTDIR_A)/imports.o\ |
---|
| 100 | $(XSLT_INTDIR_A)/keys.o\ |
---|
| 101 | $(XSLT_INTDIR_A)/namespaces.o\ |
---|
| 102 | $(XSLT_INTDIR_A)/numbers.o\ |
---|
| 103 | $(XSLT_INTDIR_A)/pattern.o\ |
---|
| 104 | $(XSLT_INTDIR_A)/preproc.o\ |
---|
| 105 | $(XSLT_INTDIR_A)/security.o\ |
---|
| 106 | $(XSLT_INTDIR_A)/templates.o\ |
---|
| 107 | $(XSLT_INTDIR_A)/transform.o\ |
---|
| 108 | $(XSLT_INTDIR_A)/variables.o\ |
---|
| 109 | $(XSLT_INTDIR_A)/xslt.o\ |
---|
| 110 | $(XSLT_INTDIR_A)/xsltutils.o |
---|
| 111 | |
---|
| 112 | # Libexslt object files. |
---|
| 113 | EXSLT_OBJS = $(EXSLT_INTDIR)/common.o\ |
---|
[20732] | 114 | $(EXSLT_INTDIR)/crypto.o\ |
---|
[18214] | 115 | $(EXSLT_INTDIR)/date.o\ |
---|
| 116 | $(EXSLT_INTDIR)/exslt.o\ |
---|
| 117 | $(EXSLT_INTDIR)/functions.o\ |
---|
| 118 | $(EXSLT_INTDIR)/math.o\ |
---|
| 119 | $(EXSLT_INTDIR)/saxon.o\ |
---|
| 120 | $(EXSLT_INTDIR)/sets.o\ |
---|
| 121 | $(EXSLT_INTDIR)/strings.o\ |
---|
| 122 | $(EXSLT_INTDIR)/dynamic.o |
---|
| 123 | EXSLT_SRCS = $(subst .o,.c,$(subst $(EXSLT_INTDIR)/,$(EXSLT_SRCDIR)/,$(EXSLT_OBJS))) |
---|
| 124 | |
---|
| 125 | # Static libexslt object files. |
---|
| 126 | EXSLT_OBJS_A = $(EXSLT_INTDIR_A)/common.o\ |
---|
[20732] | 127 | $(EXSLT_INTDIR_A)/crypto.o\ |
---|
[18214] | 128 | $(EXSLT_INTDIR_A)/date.o\ |
---|
| 129 | $(EXSLT_INTDIR_A)/exslt.o\ |
---|
| 130 | $(EXSLT_INTDIR_A)/functions.o\ |
---|
| 131 | $(EXSLT_INTDIR_A)/math.o\ |
---|
| 132 | $(EXSLT_INTDIR_A)/saxon.o\ |
---|
| 133 | $(EXSLT_INTDIR_A)/sets.o\ |
---|
| 134 | $(EXSLT_INTDIR_A)/strings.o\ |
---|
| 135 | $(EXSLT_INTDIR_A)/dynamic.o |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | # Xsltproc and friends executables. |
---|
| 139 | UTILS = $(BINDIR)/xsltproc.exe |
---|
| 140 | |
---|
| 141 | all : dep libxslt libxslta libexslt libexslta utils |
---|
| 142 | |
---|
[20732] | 143 | libxslt : $(BINDIR)\$(XSLT_SO) |
---|
[18214] | 144 | |
---|
[20732] | 145 | libxslta : $(BINDIR)\$(XSLT_A) |
---|
[18214] | 146 | |
---|
[20732] | 147 | libexslt : $(BINDIR)\$(EXSLT_SO) |
---|
[18214] | 148 | |
---|
[20732] | 149 | libexslta : $(BINDIR)\$(EXSLT_A) |
---|
[18214] | 150 | |
---|
| 151 | utils : $(UTILS) |
---|
| 152 | |
---|
| 153 | clean : |
---|
[20732] | 154 | cmd.exe /C if exist $(XSLT_INTDIR) rmdir /S /Q $(XSLT_INTDIR) |
---|
| 155 | cmd.exe /C if exist $(XSLT_INTDIR_A) rmdir /S /Q $(XSLT_INTDIR_A) |
---|
| 156 | cmd.exe /C if exist $(EXSLT_INTDIR) rmdir /S /Q $(EXSLT_INTDIR) |
---|
| 157 | cmd.exe /C if exist $(EXSLT_INTDIR_A) rmdir /S /Q $(EXSLT_INTDIR_A) |
---|
| 158 | cmd.exe /C if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR) |
---|
| 159 | cmd.exe /C if exist $(BINDIR) rmdir /S /Q $(BINDIR) |
---|
| 160 | cmd.exe /C if exist depends.mingw del depends.mingw |
---|
[18214] | 161 | |
---|
| 162 | rebuild : clean all |
---|
| 163 | |
---|
| 164 | distclean : clean |
---|
[20732] | 165 | cmd.exe /C if exist config.* del config.* |
---|
| 166 | cmd.exe /C if exist depends.* del depends.* |
---|
| 167 | cmd.exe /C if exist Makefile del Makefile |
---|
[18214] | 168 | |
---|
| 169 | install : all |
---|
[20732] | 170 | cmd.exe /C if not exist $(INCPREFIX)\$(XSLT_BASENAME) mkdir $(INCPREFIX)\$(XSLT_BASENAME) |
---|
| 171 | cmd.exe /C if not exist $(INCPREFIX)\$(EXSLT_BASENAME) mkdir $(INCPREFIX)\$(EXSLT_BASENAME) |
---|
| 172 | cmd.exe /C if not exist $(BINPREFIX) mkdir $(BINPREFIX) |
---|
| 173 | cmd.exe /C if not exist $(LIBPREFIX) mkdir $(LIBPREFIX) |
---|
| 174 | cmd.exe /C copy $(XSLT_SRCDIR)\*.h $(INCPREFIX)\$(XSLT_BASENAME) |
---|
| 175 | cmd.exe /C copy $(EXSLT_SRCDIR)\*.h $(INCPREFIX)\$(EXSLT_BASENAME) |
---|
| 176 | cmd.exe /C copy $(BINDIR)\$(XSLT_SO) $(SOPREFIX) |
---|
| 177 | cmd.exe /C copy $(BINDIR)\$(XSLT_A) $(LIBPREFIX) |
---|
| 178 | cmd.exe /C copy $(BINDIR)\$(XSLT_IMP) $(LIBPREFIX) |
---|
| 179 | cmd.exe /C copy $(BINDIR)\$(EXSLT_SO) $(SOPREFIX) |
---|
| 180 | cmd.exe /C copy $(BINDIR)\$(EXSLT_A) $(LIBPREFIX) |
---|
| 181 | cmd.exe /C copy $(BINDIR)\$(EXSLT_IMP) $(LIBPREFIX) |
---|
| 182 | cmd.exe /C copy $(BINDIR)\*.exe $(BINPREFIX) |
---|
[18214] | 183 | |
---|
| 184 | # This is a target for me, to make a binary distribution. Not for the public use, |
---|
| 185 | # keep your hands off :-) |
---|
| 186 | BDVERSION = $(LIBXSLT_MAJOR_VERSION).$(LIBXSLT_MINOR_VERSION).$(LIBXSLT_MICRO_VERSION) |
---|
| 187 | BDPREFIX = $(XSLT_BASENAME)-$(BDVERSION).win32 |
---|
| 188 | bindist : all |
---|
[20732] | 189 | $(MAKE) PREFIX=$(BDPREFIX) SOPREFIX=$(BDPREFIX)/bin install |
---|
[18214] | 190 | cscript //NoLogo configure.js genreadme $(XSLT_BASENAME) $(BDVERSION) $(BDPREFIX)\readme.txt |
---|
| 191 | |
---|
[20732] | 192 | |
---|
[18214] | 193 | # Creates the dependency files |
---|
| 194 | dep : |
---|
[20732] | 195 | $(CC) $(subst \,/,$(CFLAGS)) -MM $(subst \,/,$(XSLT_SRCS)) $(subst \,/,$(EXSLT_SRCS)) > depends.mingw |
---|
[18214] | 196 | |
---|
| 197 | |
---|
| 198 | # Makes the compiler output directory. |
---|
| 199 | $(BINDIR) : |
---|
[20732] | 200 | cmd.exe /C if not exist $(BINDIR) mkdir $(BINDIR) |
---|
[18214] | 201 | |
---|
| 202 | |
---|
| 203 | # Makes the libxslt intermediate directory. |
---|
| 204 | $(XSLT_INTDIR) : |
---|
[20732] | 205 | cmd.exe /C if not exist $(XSLT_INTDIR) mkdir $(XSLT_INTDIR) |
---|
[18214] | 206 | |
---|
| 207 | # Makes the static libxslt intermediate directory. |
---|
| 208 | $(XSLT_INTDIR_A) : |
---|
[20732] | 209 | cmd.exe /C if not exist $(XSLT_INTDIR_A) mkdir $(XSLT_INTDIR_A) |
---|
[18214] | 210 | |
---|
| 211 | # An implicit rule for libxslt compilation. |
---|
| 212 | $(XSLT_INTDIR)/%.o : $(XSLT_SRCDIR)/%.c |
---|
[20732] | 213 | $(CC) $(CFLAGS) -c -o $@ $< |
---|
[18214] | 214 | |
---|
| 215 | # An implicit rule for static libxslt compilation. |
---|
| 216 | $(XSLT_INTDIR_A)/%.o : $(XSLT_SRCDIR)/%.c |
---|
| 217 | $(CC) $(CFLAGS) -DLIBXML_STATIC -DLIBXSLT_STATIC -o $@ -c $< |
---|
| 218 | |
---|
| 219 | # Compiles libxslt source. Uses the implicit rule for commands. |
---|
| 220 | $(XSLT_OBJS) : $(XSLT_INTDIR) |
---|
| 221 | |
---|
| 222 | # Compiles static libxslt source. Uses the implicit rule for commands. |
---|
| 223 | $(XSLT_OBJS_A) : $(XSLT_INTDIR_A) |
---|
| 224 | |
---|
| 225 | # Creates the libxslt shared object. |
---|
| 226 | XSLTSO_LDFLAGS = $(LDFLAGS) -shared -Wl,--dll -Wl,--out-implib,$(BINDIR)/$(XSLT_IMP) |
---|
| 227 | XSLTSO_LDFLAGS += -Wl,--major-image-version,$(LIBXSLT_MAJOR_VERSION) |
---|
| 228 | XSLTSO_LDFLAGS += -Wl,--minor-image-version,$(LIBXSLT_MINOR_VERSION) |
---|
[20732] | 229 | $(BINDIR)\$(XSLT_SO) : $(BINDIR) $(XSLT_OBJS) |
---|
[18214] | 230 | $(LD) $(XSLTSO_LDFLAGS) -o $(BINDIR)/$(XSLT_SO) $(XSLT_OBJS) $(LIBS) -llibxml2 |
---|
| 231 | |
---|
| 232 | # Creates the libxslt archive. |
---|
[20732] | 233 | $(BINDIR)\$(XSLT_A) : $(BINDIR) $(XSLT_OBJS_A) |
---|
[18214] | 234 | $(AR) $(ARFLAGS) $(BINDIR)/$(XSLT_A) $(XSLT_OBJS_A) |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | # Creates the libexslt intermediate directory. |
---|
| 238 | $(EXSLT_INTDIR) : |
---|
[20732] | 239 | cmd.exe /C if not exist $(EXSLT_INTDIR) mkdir $(EXSLT_INTDIR) |
---|
[18214] | 240 | |
---|
| 241 | # Creates the static libexslt intermediate directory. |
---|
| 242 | $(EXSLT_INTDIR_A) : |
---|
[20732] | 243 | cmd.exe /C if not exist $(EXSLT_INTDIR_A) mkdir $(EXSLT_INTDIR_A) |
---|
[18214] | 244 | |
---|
| 245 | # An implicit rule for libexslt compilation. |
---|
| 246 | $(EXSLT_INTDIR)/%.o : $(EXSLT_SRCDIR)/%.c |
---|
| 247 | $(CC) $(CFLAGS) -I$(EXSLT_SRCDIR) -o $@ -c $< |
---|
| 248 | |
---|
| 249 | # An implicit rule for static libexslt compilation. |
---|
| 250 | $(EXSLT_INTDIR_A)/%.o : $(EXSLT_SRCDIR)/%.c |
---|
| 251 | $(CC) $(CFLAGS) -DLIBXML_STATIC -DLIBXSLT_STATIC -DLIBEXSLT_STATIC \ |
---|
| 252 | -I$(EXSLT_SRCDIR) -o $@ -c $< |
---|
| 253 | |
---|
| 254 | # Compiles libxslt source. Uses the implicit rule for commands. |
---|
| 255 | $(EXSLT_OBJS) : $(EXSLT_INTDIR) |
---|
| 256 | |
---|
| 257 | # Compiles libxslt source. Uses the implicit rule for commands. |
---|
| 258 | $(EXSLT_OBJS_A) : $(EXSLT_INTDIR_A) |
---|
| 259 | |
---|
| 260 | # Creates the libexslt shared object. |
---|
| 261 | EXSLTSO_LDFLAGS = $(LDFLAGS) -shared -Wl,--dll -Wl,--out-implib,$(BINDIR)/$(EXSLT_IMP) |
---|
| 262 | EXSLTSO_LDFLAGS += -Wl,--major-image-version,$(LIBEXSLT_MAJOR_VERSION) |
---|
| 263 | EXSLTSO_LDFLAGS += -Wl,--minor-image-version,$(LIBEXSLT_MINOR_VERSION) |
---|
[20732] | 264 | $(BINDIR)\$(EXSLT_SO) : $(BINDIR) $(EXSLT_OBJS) libxslt |
---|
[18214] | 265 | $(LD) $(EXSLTSO_LDFLAGS) -o $(BINDIR)/$(EXSLT_SO) $(EXSLT_OBJS) $(LIBS) -l$(XSLT_BASENAME) -llibxml2 |
---|
| 266 | |
---|
| 267 | # Creates the libexslt archive. |
---|
[20732] | 268 | $(BINDIR)\$(EXSLT_A) : $(BINDIR) $(EXSLT_OBJS_A) libxslta |
---|
[18214] | 269 | $(AR) $(ARFLAGS) $(BINDIR)\$(EXSLT_A) $(EXSLT_OBJS_A) |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | # Creates the utils intermediate directory. |
---|
| 273 | $(UTILS_INTDIR) : |
---|
[20732] | 274 | cmd.exe /C if not exist $(UTILS_INTDIR) mkdir $(UTILS_INTDIR) |
---|
[18214] | 275 | |
---|
| 276 | # An implicit rule for xsltproc and friends. |
---|
| 277 | APPLIBS = $(LIBS) |
---|
| 278 | APPLIBS += -llibxml2 -l$(XSLT_BASENAME) -l$(EXSLT_BASENAME) |
---|
| 279 | APP_LDFLAGS = $(LDFLAGS) |
---|
| 280 | APP_LDFLAGS += -Wl,--major-image-version,$(LIBXSLT_MAJOR_VERSION) |
---|
| 281 | APP_LDFLAGS += -Wl,--minor-image-version,$(LIBXSLT_MINOR_VERSION) |
---|
| 282 | ifeq ($(STATIC),1) |
---|
| 283 | CFLAGS += -DLIBXML_STATIC -DLIBXSLT_STATIC -DLIBEXSLT_STATIC |
---|
| 284 | APP_LDFLAGS += -Bstatic |
---|
| 285 | $(BINDIR)/%.exe : $(UTILS_SRCDIR)/%.c |
---|
| 286 | $(CC) $(CFLAGS) -o $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -c $< |
---|
| 287 | $(LD) $(APP_LDFLAGS) -o $@ $(APPLIBS) $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) |
---|
| 288 | else |
---|
| 289 | $(BINDIR)/%.exe : $(UTILS_SRCDIR)/%.c |
---|
| 290 | $(CC) $(CFLAGS) -o $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) -c $< |
---|
| 291 | $(LD) $(APP_LDFLAGS) -o $@ $(APPLIBS) $(subst .c,.o,$(UTILS_INTDIR)/$(<F)) |
---|
| 292 | endif |
---|
| 293 | |
---|
| 294 | # Builds xsltproc and friends. Uses the implicit rule for commands. |
---|
| 295 | $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxslt libxslta libexslt libexslta |
---|
| 296 | |
---|
| 297 | |
---|
[20732] | 298 | # Source dependencies, just how? |
---|
[18214] | 299 | #-include depends.mingw |
---|
| 300 | |
---|