diff options
Diffstat (limited to 'zlib/win32/Makefile.gcc')
-rw-r--r-- | zlib/win32/Makefile.gcc | 71 |
1 files changed, 47 insertions, 24 deletions
diff --git a/zlib/win32/Makefile.gcc b/zlib/win32/Makefile.gcc index 62a84301560..0a33bf6a704 100644 --- a/zlib/win32/Makefile.gcc +++ b/zlib/win32/Makefile.gcc @@ -27,24 +27,33 @@ 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 = $(PREFIX)strip + CP = cp -fp # If GNU install is available, replace $(CP) with install. INSTALL = $(CP) @@ -53,22 +62,22 @@ RM = rm -f prefix = /usr/local exec_prefix = $(prefix) -OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \ - inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o +OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ + gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o OBJA = -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example minigzip example_d minigzip_d +all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe -test: example minigzip +test: example.exe minigzip.exe ./example echo hello world | ./minigzip | ./minigzip -d -testdll: example_d minigzip_d +testdll: example_d.exe minigzip_d.exe ./example_d 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 $@ $< @@ -79,43 +88,54 @@ $(STATICLIB): $(OBJS) $(OBJA) $(IMPLIB): $(SHAREDLIB) $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o - dllwrap --driver-name $(CC) --def win32/zlib.def \ - --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o - strip $@ + $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \ + -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o + $(STRIP) $@ -example: example.o $(STATICLIB) +example.exe: example.o $(STATICLIB) $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) + $(STRIP) $@ -minigzip: minigzip.o $(STATICLIB) +minigzip.exe: minigzip.o $(STATICLIB) $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) + $(STRIP) $@ -example_d: example.o $(IMPLIB) +example_d.exe: example.o $(IMPLIB) $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) + $(STRIP) $@ -minigzip_d: minigzip.o $(IMPLIB) +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) @@ -130,7 +150,10 @@ compress.o: zlib.h zconf.h crc32.o: crc32.h zlib.h zconf.h deflate.o: deflate.h zutil.h zlib.h zconf.h example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h +gzclose.o: zlib.h zconf.h gzguts.h +gzlib.o: zlib.h zconf.h gzguts.h +gzread.o: zlib.h zconf.h gzguts.h +gzwrite.o: zlib.h zconf.h gzguts.h inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h |