Home | History | Annotate | Line # | Download | only in win32
Makefile.gcc revision 1.1.1.2
      1      1.1  christos # Makefile for zlib, derived from Makefile.dj2.
      2      1.1  christos # Modified for mingw32 by C. Spieler, 6/16/98.
      3      1.1  christos # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003.
      4  1.1.1.2  christos # Last updated: Mar 2012.
      5      1.1  christos # Tested under Cygwin and MinGW.
      6      1.1  christos 
      7      1.1  christos # Copyright (C) 1995-2003 Jean-loup Gailly.
      8      1.1  christos # For conditions of distribution and use, see copyright notice in zlib.h
      9      1.1  christos 
     10  1.1.1.2  christos # To compile, or to compile and test, type from the top level zlib directory:
     11      1.1  christos #
     12  1.1.1.2  christos #   make -fwin32/Makefile.gcc;  make test testdll -fwin32/Makefile.gcc
     13      1.1  christos #
     14      1.1  christos # To use the asm code, type:
     15      1.1  christos #   cp contrib/asm?86/match.S ./match.S
     16  1.1.1.2  christos #   make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc
     17      1.1  christos #
     18      1.1  christos # To install libz.a, zconf.h and zlib.h in the system directories, type:
     19      1.1  christos #
     20  1.1.1.2  christos #   make install -fwin32/Makefile.gcc
     21  1.1.1.2  christos #
     22  1.1.1.2  christos # BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
     23  1.1.1.2  christos #
     24  1.1.1.2  christos # To install the shared lib, append SHARED_MODE=1 to the make command :
     25  1.1.1.2  christos #
     26  1.1.1.2  christos #   make install -fwin32/Makefile.gcc SHARED_MODE=1
     27      1.1  christos 
     28      1.1  christos # Note:
     29      1.1  christos # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
     30      1.1  christos # the DLL name should be changed from "zlib1.dll".
     31      1.1  christos 
     32      1.1  christos STATICLIB = libz.a
     33      1.1  christos SHAREDLIB = zlib1.dll
     34  1.1.1.2  christos IMPLIB    = libz.dll.a
     35  1.1.1.2  christos 
     36  1.1.1.2  christos #
     37  1.1.1.2  christos # Set to 1 if shared object needs to be installed
     38  1.1.1.2  christos #
     39  1.1.1.2  christos SHARED_MODE=0
     40      1.1  christos 
     41      1.1  christos #LOC = -DASMV
     42  1.1.1.2  christos #LOC = -DZLIB_DEBUG -g
     43      1.1  christos 
     44  1.1.1.2  christos PREFIX =
     45  1.1.1.2  christos CC = $(PREFIX)gcc
     46      1.1  christos CFLAGS = $(LOC) -O3 -Wall
     47      1.1  christos 
     48      1.1  christos AS = $(CC)
     49      1.1  christos ASFLAGS = $(LOC) -Wall
     50      1.1  christos 
     51      1.1  christos LD = $(CC)
     52  1.1.1.2  christos LDFLAGS = $(LOC)
     53      1.1  christos 
     54  1.1.1.2  christos AR = $(PREFIX)ar
     55      1.1  christos ARFLAGS = rcs
     56      1.1  christos 
     57  1.1.1.2  christos RC = $(PREFIX)windres
     58      1.1  christos RCFLAGS = --define GCC_WINDRES
     59      1.1  christos 
     60  1.1.1.2  christos STRIP = $(PREFIX)strip
     61  1.1.1.2  christos 
     62      1.1  christos CP = cp -fp
     63      1.1  christos # If GNU install is available, replace $(CP) with install.
     64      1.1  christos INSTALL = $(CP)
     65      1.1  christos RM = rm -f
     66      1.1  christos 
     67  1.1.1.2  christos prefix ?= /usr/local
     68      1.1  christos exec_prefix = $(prefix)
     69      1.1  christos 
     70  1.1.1.2  christos OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
     71  1.1.1.2  christos        gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
     72      1.1  christos OBJA =
     73      1.1  christos 
     74  1.1.1.2  christos all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe
     75      1.1  christos 
     76  1.1.1.2  christos test: example.exe minigzip.exe
     77      1.1  christos 	./example
     78      1.1  christos 	echo hello world | ./minigzip | ./minigzip -d
     79      1.1  christos 
     80  1.1.1.2  christos testdll: example_d.exe minigzip_d.exe
     81      1.1  christos 	./example_d
     82      1.1  christos 	echo hello world | ./minigzip_d | ./minigzip_d -d
     83      1.1  christos 
     84      1.1  christos .c.o:
     85      1.1  christos 	$(CC) $(CFLAGS) -c -o $@ $<
     86      1.1  christos 
     87      1.1  christos .S.o:
     88      1.1  christos 	$(AS) $(ASFLAGS) -c -o $@ $<
     89      1.1  christos 
     90      1.1  christos $(STATICLIB): $(OBJS) $(OBJA)
     91      1.1  christos 	$(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
     92      1.1  christos 
     93      1.1  christos $(IMPLIB): $(SHAREDLIB)
     94      1.1  christos 
     95      1.1  christos $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
     96  1.1.1.2  christos 	$(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
     97  1.1.1.2  christos 	-o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
     98  1.1.1.2  christos 	$(STRIP) $@
     99      1.1  christos 
    100  1.1.1.2  christos example.exe: example.o $(STATICLIB)
    101      1.1  christos 	$(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
    102  1.1.1.2  christos 	$(STRIP) $@
    103      1.1  christos 
    104  1.1.1.2  christos minigzip.exe: minigzip.o $(STATICLIB)
    105      1.1  christos 	$(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
    106  1.1.1.2  christos 	$(STRIP) $@
    107      1.1  christos 
    108  1.1.1.2  christos example_d.exe: example.o $(IMPLIB)
    109      1.1  christos 	$(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
    110  1.1.1.2  christos 	$(STRIP) $@
    111      1.1  christos 
    112  1.1.1.2  christos minigzip_d.exe: minigzip.o $(IMPLIB)
    113      1.1  christos 	$(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
    114  1.1.1.2  christos 	$(STRIP) $@
    115      1.1  christos 
    116  1.1.1.2  christos example.o: test/example.c zlib.h zconf.h
    117  1.1.1.2  christos 	$(CC) $(CFLAGS) -I. -c -o $@ test/example.c
    118      1.1  christos 
    119  1.1.1.2  christos minigzip.o: test/minigzip.c zlib.h zconf.h
    120  1.1.1.2  christos 	$(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c
    121      1.1  christos 
    122  1.1.1.2  christos zlibrc.o: win32/zlib1.rc
    123  1.1.1.2  christos 	$(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
    124      1.1  christos 
    125      1.1  christos .PHONY: install uninstall clean
    126      1.1  christos 
    127  1.1.1.2  christos install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
    128  1.1.1.2  christos 	@if test -z "$(DESTDIR)$(INCLUDE_PATH)" -o -z "$(DESTDIR)$(LIBRARY_PATH)" -o -z "$(DESTDIR)$(BINARY_PATH)"; then \
    129  1.1.1.2  christos 		echo INCLUDE_PATH, LIBRARY_PATH, and BINARY_PATH must be specified; \
    130  1.1.1.2  christos 		exit 1; \
    131  1.1.1.2  christos 	fi
    132  1.1.1.2  christos 	-@mkdir -p '$(DESTDIR)$(INCLUDE_PATH)'
    133  1.1.1.2  christos 	-@mkdir -p '$(DESTDIR)$(LIBRARY_PATH)' '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig
    134  1.1.1.2  christos 	-if [ "$(SHARED_MODE)" = "1" ]; then \
    135  1.1.1.2  christos 		mkdir -p '$(DESTDIR)$(BINARY_PATH)'; \
    136  1.1.1.2  christos 		$(INSTALL) $(SHAREDLIB) '$(DESTDIR)$(BINARY_PATH)'; \
    137  1.1.1.2  christos 		$(INSTALL) $(IMPLIB) '$(DESTDIR)$(LIBRARY_PATH)'; \
    138  1.1.1.2  christos 	fi
    139  1.1.1.2  christos 	-$(INSTALL) zlib.h '$(DESTDIR)$(INCLUDE_PATH)'
    140  1.1.1.2  christos 	-$(INSTALL) zconf.h '$(DESTDIR)$(INCLUDE_PATH)'
    141  1.1.1.2  christos 	-$(INSTALL) $(STATICLIB) '$(DESTDIR)$(LIBRARY_PATH)'
    142  1.1.1.2  christos 	sed \
    143  1.1.1.2  christos 		-e 's|@prefix@|${prefix}|g' \
    144  1.1.1.2  christos 		-e 's|@exec_prefix@|${exec_prefix}|g' \
    145  1.1.1.2  christos 		-e 's|@libdir@|$(LIBRARY_PATH)|g' \
    146  1.1.1.2  christos 		-e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \
    147  1.1.1.2  christos 		-e 's|@includedir@|$(INCLUDE_PATH)|g' \
    148  1.1.1.2  christos 		-e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \
    149  1.1.1.2  christos 		zlib.pc.in > '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig/zlib.pc
    150      1.1  christos 
    151      1.1  christos uninstall:
    152  1.1.1.2  christos 	-if [ "$(SHARED_MODE)" = "1" ]; then \
    153  1.1.1.2  christos 		$(RM) '$(DESTDIR)$(BINARY_PATH)'/$(SHAREDLIB); \
    154  1.1.1.2  christos 		$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(IMPLIB); \
    155  1.1.1.2  christos 	fi
    156  1.1.1.2  christos 	-$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zlib.h
    157  1.1.1.2  christos 	-$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zconf.h
    158  1.1.1.2  christos 	-$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(STATICLIB)
    159      1.1  christos 
    160      1.1  christos clean:
    161      1.1  christos 	-$(RM) $(STATICLIB)
    162      1.1  christos 	-$(RM) $(SHAREDLIB)
    163      1.1  christos 	-$(RM) $(IMPLIB)
    164      1.1  christos 	-$(RM) *.o
    165      1.1  christos 	-$(RM) *.exe
    166      1.1  christos 	-$(RM) foo.gz
    167      1.1  christos 
    168      1.1  christos adler32.o: zlib.h zconf.h
    169      1.1  christos compress.o: zlib.h zconf.h
    170      1.1  christos crc32.o: crc32.h zlib.h zconf.h
    171      1.1  christos deflate.o: deflate.h zutil.h zlib.h zconf.h
    172  1.1.1.2  christos gzclose.o: zlib.h zconf.h gzguts.h
    173  1.1.1.2  christos gzlib.o: zlib.h zconf.h gzguts.h
    174  1.1.1.2  christos gzread.o: zlib.h zconf.h gzguts.h
    175  1.1.1.2  christos gzwrite.o: zlib.h zconf.h gzguts.h
    176      1.1  christos inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
    177      1.1  christos inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
    178      1.1  christos infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
    179      1.1  christos inftrees.o: zutil.h zlib.h zconf.h inftrees.h
    180      1.1  christos trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
    181      1.1  christos uncompr.o: zlib.h zconf.h
    182      1.1  christos zutil.o: zutil.h zlib.h zconf.h
    183