# MergeDIB makefile
#
# This makefile is in Microsoft NMAKE format.
#
# make		builds MergeDIB.exe, the "MergeDIB" application
# make clean	deletes files that can be regenerated by rebuilding MergeDIB.exe
# 

NAME = MergeDIB

!ifndef DEBUG
DEF  =
CC   = cl -c -W3 -AM -G2sw -Zp -nologo -Ows $(DEF)
ASM  = masm -Mx -t -D?QUIET
LINK = link /NOE/NOD

!else
DEF  = -DDEBUG
CC   = cl -c -W3 -AM -G2sw -Zip -nologo -Od $(DEF)
ASM  = masm -Mx -t -D?QUIET -Zi
LINK = link /NOE/NOD/CO/LI/MAP

!endif

LIBS = libw mlibcew commdlg

############################### wincom

OBJ1 = $(NAME).obj
OBJ2 = file.obj rare.obj dib.obj mem.obj
OBJ  = $(OBJ1) $(OBJ2)

.c.obj:
	$(CC) -NT$* $*.c

.asm.obj:
	$(ASM) -DSEGNAME=$* $*;

!ifdef DEBUG
goal: $(NAME).sym $(NAME).exe 
!else
goal: $(NAME).exe 
!endif

$(NAME).exe $(NAME).map: $(OBJ) $(NAME).res $(NAME).def
	$(LINK) @<<
	$(OBJ1) +
	$(OBJ2),
	$(NAME), $(NAME), $(LIBS), $(NAME).def
<<
	rc $(NAME).res
!ifdef DEBUG
	cvpack $(NAME).exe
!endif

$(NAME).res: $(NAME).rc $(NAME).ico $(NAME).h
	rc -r $(NAME).rc

$(NAME).sym: $(NAME).map $(NAME).exe
	mapsym $(NAME).map

# dependencies and segmentation...
$(NAME).obj : $(NAME).c $(NAME).h ;	$(CC) -NT _TEXT $*.c
file.obj : file.c $(NAME).h ;		$(CC) -NT RARE  $*.c
rare.obj : rare.c  $(NAME).h ;		$(CC) -NT RARE  $*.c
dib.obj  : dib.c dib.h gmem.h ;		$(CC) -NT _TEXT $*.c
mem.obj  : mem.asm ;			$(ASM) -DSEGNAME=_TEXT $*;

clean:
	del *.exe
	del *.res
	del *.obj
	del *.map
	del *.sym

copy:
	copy $(NAME).exe ..\bin
	copy $(NAME).sym ..\bin
