ext/xlsxwriter/libxlsxwriter/src/Makefile in xlsxwriter-0.2.1.pre.2 vs ext/xlsxwriter/libxlsxwriter/src/Makefile in xlsxwriter-0.2.2
- old
+ new
@@ -1,18 +1,22 @@
###############################################################################
#
# Makefile for libxlsxwriter library.
#
-# Copyright 2014-2019, John McNamara, jmcnamara@cpan.org
+# Copyright 2014-2020, John McNamara, jmcnamara@cpan.org
#
# Keep the output quiet by default.
Q=@
ifdef V
Q=
endif
+DESTDIR ?=
+PREFIX ?= /usr/local
+OPT_LEVEL ?= -O3
+
# Directory variables.
OBJS_DIR = .
INC_DIR = ../include
LIBS = -lz
@@ -25,33 +29,47 @@
MINIZIP_DIR = ../third_party/minizip
MINIZIP_OBJ = $(MINIZIP_DIR)/ioapi.o $(MINIZIP_DIR)/zip.o
MINIZIP_SO = $(MINIZIP_DIR)/ioapi.so $(MINIZIP_DIR)/zip.so
endif
-
ifdef USE_STANDARD_TMPFILE
# Use standard/C tmpfile().
CFLAGS += -DUSE_STANDARD_TMPFILE
else
# Use tmpfileplus (the default).
TMPFILEPLUS_DIR = ../third_party/tmpfileplus
TMPFILEPLUS_OBJ = $(TMPFILEPLUS_DIR)/tmpfileplus.o
TMPFILEPLUS_SO = $(TMPFILEPLUS_DIR)/tmpfileplus.so
endif
+ifdef USE_NO_MD5
+# Don't use MD5 to avoid duplicate image files.
+CFLAGS += -DUSE_NO_MD5
+else
+# Use md5 (the default).
+MD5_DIR = ../third_party/md5
+MD5_OBJ = $(MD5_DIR)/md5.o
+MD5_SO = $(MD5_DIR)/md5.so
+endif
+
# Set flag for big endian architecture.
ifdef USE_BIG_ENDIAN
CFLAGS += -DLXW_BIG_ENDIAN
endif
# Use a user-defined double number formatting function.
ifdef USE_DOUBLE_FUNCTION
CFLAGS += -DUSE_DOUBLE_FUNCTION
endif
+# Use fmemopen() to avoid creating certain temporary files
+ifdef USE_FMEMOPEN
+CFLAGS += -DUSE_FMEMOPEN
+endif
+
# Flags passed to compiler.
-CFLAGS += -g -O3 -Wall -Wextra -pedantic -ansi
+CFLAGS += -g $(OPT_LEVEL) -Wall -Wextra -Wstrict-prototypes -pedantic -ansi
# Ignore icc remarks about inlining limits.
ifeq ($(CC),icc)
CFLAGS +=-diag-disable=11074,11076
@@ -75,11 +93,11 @@
UNAME := $(shell uname)
# Change make options on OS X.
ifeq ($(UNAME), Darwin)
LIBXLSXWRITER_SO = libxlsxwriter.dylib
-SOFLAGS = -dynamiclib $(FPIC) -install_name /usr/lib/$(LIBXLSXWRITER_SO)
+SOFLAGS = -dynamiclib $(FPIC) -install_name $(PREFIX)/lib/$(LIBXLSXWRITER_SO)
endif
# Check for MinGW/MinGW64/Cygwin environments.
ifneq (,$(findstring MINGW, $(UNAME)))
MING_LIKE = y
@@ -115,22 +133,22 @@
test_lib : libxlsxwriter_test.a
# The static library.
$(LIBXLSXWRITER_A) : $(OBJS)
- $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $^
+ $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $(MD5_OBJ) $^
# The dynamic library.
ifeq ($(findstring m32,$(CFLAGS)),m32)
ARCH = -m32
endif
$(LIBXLSXWRITER_SO) : $(SOBJS)
- $(Q)$(CC) $(LDFLAGS) $(SOFLAGS) $(ARCH) -o $@ $(MINIZIP_SO) $(TMPFILEPLUS_SO) $^ $(LIBS)
+ $(Q)$(CC) $(LDFLAGS) $(SOFLAGS) $(ARCH) -o $@ $(MINIZIP_SO) $(TMPFILEPLUS_SO) $(MD5_SO) $^ $(LIBS)
# The test library.
$(LIBXLSXWRITER_TO) : $(TOBJS)
- $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $^
+ $(Q)$(AR) $(ARFLAGS) $@ $(MINIZIP_OBJ) $(TMPFILEPLUS_OBJ) $(MD5_OBJ) $^
# Minimal target for quick compile without creating the libs.
test_compile : $(OBJS)
# Targets for the object files.