# -*- Mode: makefile; -*-

#
# Makefile for mewls.exe/mewencode.exe
#                             for Visual C++ / Borland C++ Compiler
#

# Note:
# 1. If you want to use Cygwin, read ../00readme and follow its
#    instructionx.
# 2. You need pre-compiled and original zlib packages.
#    Please download original tarball from
#      http://www.gzip.org/zlib/,
#    and put
#      zconf.h, zlib.h, zlib.lib
#    to suitable directory.
# 2. If you want to use Borland C++ Compiler, you need import library.
#    > implib -a <filename_of_import_library> <filename_of_zlib.dll>

# **** Please modify ****
ZLIBINC = C:/usr/local/zlib
ZLIBLIB = C:/usr/local/zlib/zlib.lib

# for Visual C++
CC      = cl
CFLAGS  = -nologo -O2 -W3 -MT -Iw32 -I$(ZLIBINC)
EXEFLAG = -Fe

# for Borland C++
#CC      = bcc32
#CFLAGS  = -O2 -w -Iw32 -I$(ZLIBINC)
#EXEFLAG = -e


################################################################

TARGET = mewencode.exe mewls.exe

MEWENCODEOBJS = mewencode.obj utils.obj
MEWLSOBJS     = mewls.obj utils.obj pattern.obj dirent.obj

all : $(TARGET)

config.h : w32\config.h
	copy w32\config.h config.h

mewencode.exe : $(MEWENCODEOBJS)
	$(CC) $(CFLAGS) $(EXEFLAG)mewencode.exe $(MEWENCODEOBJS) $(ZLIBLIB)
mewls.exe : $(MEWLSOBJS)
	$(CC) $(CFLAGS) $(EXEFLAG)mewls.exe $(MEWLSOBJS)

mewencode.obj : mewencode.c mew.h config.h
	$(CC) $(CFLAGS) -c mewencode.c
mewls.obj : mewls.c mew.h config.h
	$(CC) $(CFLAGS) -c mewls.c
utils.obj : utils.c mew.h config.h
	$(CC) $(CFLAGS) -c utils.c
pattern.obj : pattern.c mew.h config.h
	$(CC) $(CFLAGS) -c pattern.c
dirent.obj : w32\dirent.c w32\dirent.h w32\w32.h
	$(CC) $(CFLAGS) -c w32\dirent.c
