1# Sample makefile for pngcheck using mingw32-gcc (native or cross) and make. 2# This one is currently set up for Win64 cross-compilation from Linux. 3# 4# Greg Roelofs 5# Last modified: 31 January 2021 6# 7# Invoke this makefile from a DOS-prompt window or xterm or whatever via: 8# 9# make -f Makefile.mingw64 10# 11# This makefile assumes zlib has already been built or downloaded and is in 12# a subdirectory at the same level as the current subdirectory (as indicated 13# by the ZPATH macro below). Edit as appropriate. 14# 15# Note that the names of the dynamic and static zlib libraries used below may 16# change in later releases of the library. This makefile builds statically 17# linked executables, but that can be changed by uncommenting the appropriate 18# ZLIB line. 19 20 21# macros -------------------------------------------------------------------- 22 23#ZPATH = ../zlib 24ZPATH = ../zlib-1.2.11-win64 25ZINC = -I$(ZPATH) 26#ZLIB = $(ZPATH)/libzdll.a # link dynamically against DLL 27ZLIB = $(ZPATH)/libz.a # link statically 28 29INCS = $(ZINC) 30LIBS = $(ZLIB) 31 32#CC = gcc 33CC = x86_64-w64-mingw32-gcc # Linux -> Win64 cross-compilation 34LD = $(CC) 35RM = rm -f 36CFLAGS = -O -Wall $(INCS) $(MINGW_CCFLAGS) -DUSE_ZLIB 37# [note that -Wall is a gcc-specific compilation flag ("most warnings on")] 38LDFLAGS = $(MINGW_LDFLAGS) 39O = .o 40E = .win64.exe 41 42PROG = pngcheck 43PROG2 = pngsplit 44PROG3 = png-fix-IDAT-windowsize 45 46EXES = $(PROG)$(E) $(PROG2)$(E) $(PROG3)$(E) 47 48 49# implicit make rules ------------------------------------------------------- 50 51.c$(O): 52 $(CC) -c $(CFLAGS) $< 53 54 55# dependencies -------------------------------------------------------------- 56 57all: $(EXES) 58 59$(PROG)$(E): $(PROG).c 60 $(CC) $(CFLAGS) -o $@ $(PROG).c $(LIBS) 61 62# both of these require zlib, too (for crc32() function) 63$(PROG2)$(E): gpl/$(PROG2).c 64 $(CC) $(CFLAGS) -o $@ gpl/$(PROG2).c $(LIBS) 65 66$(PROG3)$(E): gpl/$(PROG3).c 67 $(CC) $(CFLAGS) -o $@ gpl/$(PROG3).c $(LIBS) 68 69 70# maintenance --------------------------------------------------------------- 71 72clean: 73 $(RM) $(EXES) 74