summaryrefslogtreecommitdiffstats
path: root/compat/zlib/win32/Makefile.gcc
diff options
context:
space:
mode:
Diffstat (limited to 'compat/zlib/win32/Makefile.gcc')
-rw-r--r--compat/zlib/win32/Makefile.gcc44
1 files changed, 31 insertions, 13 deletions
diff --git a/compat/zlib/win32/Makefile.gcc b/compat/zlib/win32/Makefile.gcc
index abe3d5a..0a33bf6 100644
--- a/compat/zlib/win32/Makefile.gcc
+++ b/compat/zlib/win32/Makefile.gcc
@@ -27,25 +27,32 @@ STATICLIB = libz.a
SHAREDLIB = zlib1.dll
IMPLIB = libzdll.a
+#
+# Set to 1 if shared object needs to be installed
+#
+SHARED_MODE=0
+
#LOC = -DASMV
#LOC = -DDEBUG -g
-CC = gcc
+PREFIX =
+CC = $(PREFIX)gcc
CFLAGS = $(LOC) -O3 -Wall
+EXTRA_CFLAGS = -DNO_VIZ
AS = $(CC)
ASFLAGS = $(LOC) -Wall
LD = $(CC)
-LDFLAGS = $(LOC) -s
+LDFLAGS = $(LOC)
-AR = ar
+AR = $(PREFIX)ar
ARFLAGS = rcs
-RC = windres
+RC = $(PREFIX)windres
RCFLAGS = --define GCC_WINDRES
-STRIP = strip
+STRIP = $(PREFIX)strip
CP = cp -fp
# If GNU install is available, replace $(CP) with install.
@@ -70,7 +77,7 @@ testdll: example_d.exe minigzip_d.exe
echo hello world | ./minigzip_d | ./minigzip_d -d
.c.o:
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.S.o:
$(AS) $(ASFLAGS) -c -o $@ $<
@@ -81,43 +88,54 @@ $(STATICLIB): $(OBJS) $(OBJA)
$(IMPLIB): $(SHAREDLIB)
$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
- $(CC) -shared -Wl,--out-implib,$(IMPLIB) \
+ $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
-o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
$(STRIP) $@
example.exe: example.o $(STATICLIB)
$(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
+ $(STRIP) $@
minigzip.exe: minigzip.o $(STATICLIB)
$(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
+ $(STRIP) $@
example_d.exe: example.o $(IMPLIB)
$(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
+ $(STRIP) $@
minigzip_d.exe: minigzip.o $(IMPLIB)
$(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
+ $(STRIP) $@
zlibrc.o: win32/zlib1.rc
$(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
-# INCLUDE_PATH and LIBRARY_PATH must be set.
+# BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
.PHONY: install uninstall clean
-install: zlib.h zconf.h $(LIB)
- -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH)
- -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH)
+install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
+ -@mkdir -p $(INCLUDE_PATH)
+ -@mkdir -p $(LIBRARY_PATH)
+ -if [ "$(SHARED_MODE)" = "1" ]; then \
+ mkdir -p $(BINARY_PATH); \
+ $(INSTALL) $(SHAREDLIB) $(BINARY_PATH); \
+ $(INSTALL) $(IMPLIB) $(LIBRARY_PATH); \
+ fi
-$(INSTALL) zlib.h $(INCLUDE_PATH)
-$(INSTALL) zconf.h $(INCLUDE_PATH)
-$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
- -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH)
uninstall:
+ -if [ "$(SHARED_MODE)" = "1" ]; then \
+ $(RM) $(BINARY_PATH)/$(SHAREDLIB); \
+ $(RM) $(LIBRARY_PATH)/$(IMPLIB); \
+ fi
-$(RM) $(INCLUDE_PATH)/zlib.h
-$(RM) $(INCLUDE_PATH)/zconf.h
-$(RM) $(LIBRARY_PATH)/$(STATICLIB)
- -$(RM) $(LIBRARY_PATH)/$(IMPLIB)
clean:
-$(RM) $(STATICLIB)