# =============================================================================
# makefile -- nmake file for ResGauge.
# -----------------------------------------------------------------------------
# linker flags:
#   a:16     align on 16-byte (paragraph) boundaries
#   nod      ignore default libraries
# -----------------------------------------------------------------------------
# resource compiler flags:
#   r        compile only
#   t        mark for protected mode only
# -----------------------------------------------------------------------------
# C compiler flags:
#   c        compile only
#   nologo   don't display the startup logo
#   AM       generate medium-model code
#   DSTRICT  enable more rigorous type and parameter checking
#   G2s      generate '286 code
#            disable stack checking
#   GA       optimize entry/exit code for protected mode applications
#   Ow       assume cross-function aliasing
#   W3       set warnings to level 3
#   WX       treat warnings as errors
#   Zp       pack structures on byte boundaries
# =============================================================================


# ------
# macros
# ------
CFLAGS  = -c -nologo -AM -DSTRICT -G2s -GA -Ow -W3 -WX -Zp
INCLS   = $(NAME).h
LFLAGS  = /a:16 /nod
LIBS    = libw mlibcew commdlg toolhelp
NAME    = resgauge
OBJS    = about.obj config.obj init.obj profile.obj resgauge.obj
RCFILES = $(NAME).rc $(NAME).h $(NAME).ico
RFLAGS  = -r
SRCS    = about.c config.c init.c profile.c resgauge.c


# ---------------
# inference rules
# ---------------
.c.obj:
    cl $(CFLAGS) $*.c

.rc.res:
    rc $(RFLAGS) $*.rc


# ------------
# dependencies
# ------------
all: $(NAME).exe

$(SRCS:.c=.obj): $(INCLS)

$(NAME).res: $(RCFILES)

$(NAME).exe: $(OBJS) $(NAME).res $(NAME).def
    link @<<
    $(LFLAGS) $(OBJS),
    $(NAME).exe,
    nul,
    $(LIBS),
    $(NAME).def
<<
    rc -t resgauge.res resgauge.exe


# ===============
# end of makefile
# ===============
