# Makefile template for use under win32
# for the compiler system lcc-win32.
#

# Your compiler utilities here
CC=lcc.exe
LIB=lcclib.exe
LINK=lcclnk.exe

# If you want to build a dynamic library, uncomment the following two lines
# and comment the next two.
#LIBS=$(DLLNAME)
#CFLAGS= -A -ansic /DWIN32 /DDRV_DS /DDRV_WIN /DHAVE_FCNTL_H /DHAVE_MALLOC_H /DHAVE_LIMITS_H /DDLL_EXPORTS
LIBS=$(LIBNAME)
CFLAGS= -A -ansic /DWIN32 /DDRV_DS /DDRV_WIN /DHAVE_FCNTL_H /DHAVE_MALLOC_H /DHAVE_LIMITS_H

# Compile command
COMPILE=$(CC) -errout=err.out $(CFLAGS) /I..\include /I.. /I..\win32

.SUFFIXES:
.SUFFIXES: .o .c

LIBNAME=mikmod.lib
DLLNAME=mikmod.dll

DRIVER_OBJ=drv_ds.o drv_win.o

OBJ=$(DRIVER_OBJ) \
    drv_nos.o drv_raw.o drv_stdout.o drv_wav.o \
    load_669.o load_amf.o load_dsm.o load_far.o load_gdm.o load_it.o  \
    load_imf.o load_m15.o load_med.o load_mod.o load_mtm.o load_okt.o \
    load_s3m.o load_stm.o load_stx.o load_ult.o load_uni.o load_xm.o \
    mmalloc.o mmerror.o mmio.o \
    mdriver.o mdreg.o mloader.o mlreg.o mlutil.o mplayer.o munitrk.o mwav.o \
    npertab.o sloader.o virtch.o virtch2.o virtch_common.o

all:            $(LIBS)

clean:
	FOR %F IN ( $(LIBNAME) $(DLLNAME) mikmod.exp *.o ) DO IF EXIST %F ERASE %F

distclean:
	FOR %F IN ( ..\include\mikmod.h ..\win32\mikmod_build.h Makefile ) DO IF EXIST %F ERASE %F

$(DLLNAME):     $(OBJ) mikmod.def
	$(LINK) /DLL /OUT:$@ mikmod.def *.o dsound.lib winmm.lib

$(LIBNAME):     $(OBJ)
	$(LIB) /OUT:$(LIBNAME) *.o

..\include\mikmod.h ..\win32\mikmod_build.h:	mikmod_build.h
	COPY mikmod_build.h ..\win32\mikmod_build.h
	COPY mikmod_build.h ..\include\mikmod.h

drv_ds.o:       ..\drivers\drv_ds.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\drivers\drv_ds.c
drv_nos.o:      ..\drivers\drv_nos.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\drivers\drv_nos.c
drv_raw.o:      ..\drivers\drv_raw.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\drivers\drv_raw.c
drv_stdout.o:   ..\drivers\drv_stdout.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\drivers\drv_stdout.c
drv_wav.o:      ..\drivers\drv_wav.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\drivers\drv_wav.c
drv_win.o:       ..\drivers\drv_win.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\drivers\drv_win.c
load_669.o:     ..\loaders\load_669.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_669.c
load_amf.o:     ..\loaders\load_amf.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_amf.c
load_dsm.o:     ..\loaders\load_dsm.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_dsm.c
load_far.o:     ..\loaders\load_far.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_far.c
load_gdm.o:     ..\loaders\load_gdm.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_gdm.c
load_it.o:      ..\loaders\load_it.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_it.c
load_imf.o:     ..\loaders\load_imf.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_imf.c
load_m15.o:     ..\loaders\load_m15.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_m15.c
load_med.o:     ..\loaders\load_med.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_med.c
load_mod.o:     ..\loaders\load_mod.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_mod.c
load_mtm.o:     ..\loaders\load_mtm.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_mtm.c
load_okt.o:     ..\loaders\load_okt.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_okt.c
load_s3m.o:     ..\loaders\load_s3m.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_s3m.c
load_stm.o:     ..\loaders\load_stm.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_stm.c
load_stx.o:     ..\loaders\load_stx.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_stx.c
load_ult.o:     ..\loaders\load_ult.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_ult.c
load_uni.o:     ..\loaders\load_uni.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_uni.c
load_xm.o:      ..\loaders\load_xm.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\loaders\load_xm.c
mmalloc.o:      ..\mmio\mmalloc.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\mmio\mmalloc.c
mmerror.o:      ..\mmio\mmerror.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\mmio\mmerror.c
mmio.o:         ..\mmio\mmio.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\mmio\mmio.c
mdriver.o:      ..\playercode\mdriver.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\mdriver.c
mdreg.o:        ..\playercode\mdreg.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\mdreg.c
mloader.o:      ..\playercode\mloader.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\mloader.c
mlreg.o:        ..\playercode\mlreg.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\mlreg.c
mlutil.o:       ..\playercode\mlutil.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\mlutil.c
mplayer.o:      ..\playercode\mplayer.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\mplayer.c
munitrk.o:      ..\playercode\munitrk.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\munitrk.c
mwav.o:         ..\playercode\mwav.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\mwav.c
npertab.o:      ..\playercode\npertab.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\npertab.c
sloader.o:      ..\playercode\sloader.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\sloader.c
virtch.o:       ..\playercode\virtch.c ..\playercode\virtch_common.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\virtch.c
virtch2.o:      ..\playercode\virtch2.c ..\playercode\virtch_common.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\virtch2.c
virtch_common.o:        ..\playercode\virtch_common.c \
	                ..\win32\mikmod_build.h ..\include\mikmod_internals.h
	$(COMPILE) /Fo$@ ..\playercode\virtch_common.c
