Compile GraphApp 3.02 with the Mingw compiler:

1) Unzip de GraphApp package using lowercase filenames ("unzip -L" using the InfoZIP unzip)

2) Coment in src/win32/folder.c the three lines that redefines chdir, mkdir and rmdir

3) Rename in src/win32/init.c the main call and definition to APP_main (lines 125 and 140)

4) Rename in demo/*.c the main routine to APP_main

5) Copy the makefile provide below to the src subdirectory

6) Go to the source subdir, run "make", them run "make demos"

Next is the makefile (remember to replace spaces by tabs in commands if you lost they using copy and paste).

A mini-howto to install the Mingw compiler is provided at the end.


# Makefile for App (Mingw version)

CC               = gcc
AR               = ar
RANLIB           = ranlib
LD               = ld
MAKE_STATIC_LIB  = ar rc

# Makefile rules

CFLAGS       = -O2 -Wall -I. -Iwin32 -Ilibgif -Ilibjpeg -Ilibpng -Ilibz

APP_OBJECTS   = graphics/clipline.o graphics/control.o  graphics/drawimg.o \
		graphics/drawing.o  graphics/drawtext.o graphics/image.o \
		graphics/imglist.o  graphics/malloc.o   graphics/palette.o \
		graphics/point.o    graphics/rect.o     graphics/region.o \
		graphics/rgb.o      graphics/str.o      graphics/utf8.o \
		gui/button.o        gui/checkbox.o      gui/dialog.o \
		gui/dropfld.o       gui/droplist.o      gui/field.o \
		gui/imagebtn.o      gui/imglabel.o      gui/label.o \
		gui/listbox.o       gui/menu.o          gui/radiobtn.o \
		gui/scroll.o        gui/textbox.o \
		imgfmt/imgread.o    imgfmt/imgwrite.o   imgfmt/readgif.o \
		imgfmt/writegif.o   imgfmt/readjpg.o    imgfmt/writejpg.o \
		imgfmt/readpng.o    imgfmt/writepng.o \
		win32/bmap.o        win32/bmapimg.o     win32/clipbrd.o \
		win32/drawbmap.o    win32/drawwin.o     win32/event.o \
		win32/font.o        win32/graphics.o    win32/init.o \
		win32/timer.o       win32/win.o         win32/folder.o

GIF_OBJECTS   = libgif/gif.o

JPEG_OBJECTS  = libjpeg/jcapimin.o libjpeg/jcapistd.o libjpeg/jccoefct.o \
		libjpeg/jccolor.o  libjpeg/jcdctmgr.o libjpeg/jchuff.o   \
		libjpeg/jcinit.o   libjpeg/jcmainct.o libjpeg/jcmarker.o \
		libjpeg/jcmaster.o libjpeg/jcomapi.o  libjpeg/jcparam.o  \
		libjpeg/jcphuff.o  libjpeg/jcprepct.o libjpeg/jcsample.o \
		libjpeg/jctrans.o  libjpeg/jdapimin.o libjpeg/jdapistd.o \
		libjpeg/jdatadst.o libjpeg/jdatasrc.o libjpeg/jdcoefct.o \
		libjpeg/jdcolor.o  libjpeg/jddctmgr.o libjpeg/jdhuff.o   \
		libjpeg/jdinput.o  libjpeg/jdmainct.o libjpeg/jdmarker.o \
		libjpeg/jdmaster.o libjpeg/jdmerge.o  libjpeg/jdphuff.o  \
		libjpeg/jdpostct.o libjpeg/jdsample.o libjpeg/jdtrans.o  \
		libjpeg/jerror.o   libjpeg/jfdctflt.o libjpeg/jfdctfst.o \
		libjpeg/jfdctint.o libjpeg/jidctflt.o libjpeg/jidctfst.o \
		libjpeg/jidctint.o libjpeg/jidctred.o libjpeg/jmemmgr.o  \
		libjpeg/jmemnobs.o libjpeg/jquant1.o  libjpeg/jquant2.o  \
		libjpeg/jutils.o

PNG_OBJECTS   = libpng/png.o       libpng/pngerror.o  libpng/pngget.o   \
		libpng/pngmem.o    libpng/pngpread.o  libpng/pngread.o  \
		libpng/pngrio.o    libpng/pngrtran.o  libpng/pngrutil.o \
		libpng/pngset.o    libpng/pngtrans.o  libpng/pngwio.o   \
		libpng/pngwrite.o  libpng/pngwtran.o  libpng/pngwutil.o

LIBZ_OBJECTS  = libz/adler32.o     libz/compress.o    libz/crc32.o    \
		libz/deflate.o     libz/infblock.o    libz/infcodes.o \
		libz/inffast.o     libz/inflate.o     libz/inftrees.o \
		libz/infutil.o     libz/trees.o       libz/uncompr.o  \
		libz/zutil.o

OBJECTS       = $(APP_OBJECTS) $(GIF_OBJECTS) $(JPEG_OBJECTS) \
		$(PNG_OBJECTS) $(LIBZ_OBJECTS)

HEADERS       = apptypes.h app.h win32/appint.h

LIB           = libapp.a

WLIBS         = -mwindows

static:	apptypes.h $(LIB)

$(LIB):	$(OBJECTS) $(HEADERS)
	if exist $(LIB) del $(LIB)
	$(MAKE_STATIC_LIB) $(LIB) win32/*.o graphics/*.o gui/*.o imgfmt/*.o libgif/*.o libjpeg/*.o libpng/*.o libz/*.o
	$(RANLIB) $(LIB)

apptypes.h: apptypes.o
	$(CC) $(CFLAGS) -o apptypes.exe apptypes.o
	./apptypes
	if exist apptypes.exe del apptypes.exe

demos: demo1 demo2 demo3 demo4 demo5

demo1:	static demo/imagine.o
	$(CC) $(CFLAGS) -o demo/imagine.exe demo/imagine.o $(LIB) $(WLIBS)

demo2:	static demo/tester.o
	$(CC) $(CFLAGS) -o demo/tester.exe demo/tester.o $(LIB) $(WLIBS)

demo3:	static demo/viewutf8.o
	$(CC) $(CFLAGS) -o demo/viewutf8.exe demo/viewutf8.o $(LIB) $(WLIBS)

demo4:	static demo/imgtest.o
	$(CC) $(CFLAGS) -o demo/imgtest.exe demo/imgtest.o $(LIB) $(WLIBS)

demo5:	static demo/blend.o
	$(CC) $(CFLAGS) -o demo/blend.exe demo/blend.o $(LIB) $(WLIBS)

tidy:
	if exist *.o del *.o
	if exist demo\*.o del demo\*.o
	if exist graphics\*.o del graphics\*.o
	if exist gui\*.o del gui\*.o
	if exist imgfmt\*.o del imgfmt\*.o
	if exist libgif\*.o del libgif\*.o
	if exist libjpeg\*.o del libjpeg\*.o
	if exist libpng\*.o del libpng\*.o
	if exist libz\*.o del libz\*.o
	if exist win32\*.o del win32\*.o

clean:	tidy
	if exist $(LIB) del $(LIB)

.c.o:
	$(CC) -c $(CFLAGS) $*.c -o $*.o


    These is a how-to for people who want to make the win32 version,
    but don't know about the mingw compiler:

    1.- First, download the mingw distribution:

    ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95.2/
    gcc-2.95.2-msvcrt.exe
    ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95.2/
    mingw32-docs-html.exe
    ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/gcc-2.95.2/fixes/
    quote-fix-msvcrt.exe

    2.- Create a \MINGW dir and decompress the three files on it (The files
    are not instalers, only auto-decompress files)

    3.- Create a \MINGW\SETVAR.BAT file with the line:

    SET PATH=C:\MINGW\BIN;%PATH%

    4.- Open a DOS window and execute \MINGW\SETVAR

    5.- You are ready