#
# TITLE:       MAKE60.OS2
#
# DESCRIPTION:
#
#   This is a makefile that is designed to make the example programs
#   provided in the Programmers Reference.
#
#   Note: This makefile expects the following environment variables to exist:
#
#       - LANSRC   : The local LAN manager source directory
#                       (e.g. C:\LANMAN\NETSRC)
#       - LIB      : The location of system libraries
#                       (e.g. C:\LANMAN\NETSRC\LIB;C:\LIB;)
#       - INCLUDE  : The path down which to search for included header files.
#                       (e.g. C:\LANMAN\NETSRC\H;C:\INCLUDE;)

#
# Global Definitions
#

CC=cl                            # Compile Command
LINK=link                        # Link Command
CFLAGS=/W3 /Od /Zi               # Global Compile flags
LFLAGS=/CO /STACK:0X4000 /NOD:slibce    # Global Link flags
NOLINK=/c                        # No link flag
INCDIRS=-I$(LANSRC)\h -I$(OS2SRC)\INCLUDE # Include directories

# Default libraries
APILIB=lan.lib
SLIBCE=slibcep.lib
LLIBCMT=llibcmt.lib

#
# Local Definitions
#

CACCESS=  netacc.c
CACCOUNT= netacct.c
CALERT=   netalrt.c
CAUDIT=   netaud.c
CNETBIOS= nbstat.c netbios.c
CCHARDEV= netchar1.c netchar2.c
CCONFIG=  netcnfg.c
CCONNECT= netcons.c
CDOMAIN=  netdom.c
CERROR=   neterr.c
CFILE=    netfile.c
CGROUP=   netgroup.c
CMAILSLOT=netmail.c
CMESSAGE= netmsg.c
CHANDLE=  nethand1.c  nethand2.c
CPIPES=   npserver.c  npclient.c
CPRINTD=  netprd.c
CPRINTQ=  netprq.c
CPRINTJ=  netprj.c
CREMOTE=  netrem.c
CSAMPLES= samples.c
CSERVER=  netserv.c
CSERVICE= netsvc.c
CSESSION= netsess.c
CSHARE=   netshare.c
CSTATS=   netstats.c
CUSE=     netuse.c
CUSER=    netuser.c
CWKSTA=   netwksta.c

HSOURCE= $(LANSRC)\h\netcons.h          \
         $(LANSRC)\h\neterr.h           \
         $(LANSRC)\h\netstats.h         \
         $(LANSRC)\h\access.h           \
         $(LANSRC)\h\alert.h            \
         $(LANSRC)\h\chardev.h          \
         $(LANSRC)\h\audit.h            \
         $(LANSRC)\h\remutil.h          \
         $(LANSRC)\h\message.h          \
         $(LANSRC)\h\mailslot.h         \
         $(LANSRC)\h\pmspl.h            \
         samples.h

LIBSRC=  $(LANSRC)\lib\$(APILIB)  samples.lib

#
# Targets
#

clean:
         del *.exe *.obj *.map *.lib

all:     samples.lib access account alert audit chardev config connect domain error file group handle mail message netbios pipes prd prj prq remote server service session share stats use user wksta

access:  $(CACCESS:.c=.exe)

account: $(CACCOUNT:.c=.exe)

alert:   $(CALERT:.c=.exe)

audit:   $(CAUDIT:.c=.exe)

chardev: $(CCHARDEV:.c=.exe)

config:  $(CCONFIG:.c=.exe)

connect: $(CCONNECT:.c=.exe)

domain:  $(CDOMAIN:.c=.exe)

error:   $(CERROR:.c=.exe)

file:    $(CFILE:.c=.exe)

group:   $(CGROUP:.c=.exe)

mail:    $(CMAILSLOT:.c=.exe)

message: $(CMESSAGE:.c=.exe)

handle:  $(CHANDLE:.c=.exe)

netbios:  $(CNETBIOS:.c=.exe)

pipes:   $(CPIPES:.c=.exe)

prd:     $(CPRINTD:.c=.exe)

prj:     $(CPRINTJ:.c=.exe)

prq:     $(CPRINTQ:.c=.exe)

remote:  $(CREMOTE:.c=.exe)

server:  $(CSERVER:.c=.exe)

service: $(CSERVICE:.c=.exe)

session: $(CSESSION:.c=.exe)

share:   $(CSHARE:.c=.exe)

stats:   $(CSTATS:.c=.exe)

use:     $(CUSE:.c=.exe)

user:    $(CUSER:.c=.exe)

wksta:   $(CWKSTA:.c=.exe)

#
# Inference Rules
#

.c.obj:
        $(CC) $(NOLINK) $(CFLAGS) $(INCDIRS) $*.c

.obj.exe:
        $(LINK) $(LFLAGS) $*,$*,$*, os2.lib+samples.lib+$(SLIBCE)+$(APILIB)+pmspl.lib;

samples.lib: samples.obj
        lib samples -+samples.obj;

#
# Dependencies
#

$(CACCESS:.c=.obj)      \
$(CACCOUNT:.c=.obj)     \
$(CALERT:.c=.obj)       \
$(CAUDIT:.c=.obj)       \
$(CCHARDEV:.c=.obj)     \
$(CCONFIG:.c=.obj)      \
$(CCONNECT:.c=.obj)     \
$(CDOMAIN:.c=.obj)      \
$(CERROR:.c=.obj)       \
$(CFILE:.c=.obj)        \
$(CGROUP:.c=.obj)       \
$(CHANDLE:.c=.obj)      \
$(CMAILSLOT:.c=.obj)    \
$(CMESSAGE:.c=.obj)     \
$(CNETBIOS:.c=.obj)     \
$(CPIPES:.c=.obj)       \
$(CPRINTJ:.c=.obj)      \
$(CPRINTQ:.c=.obj)      \
$(CPRINTD:.c=.obj)      \
$(CREMOTE:.c=.obj)      \
$(CSERVER:.c=.obj)      \
$(CSERVICE:.c=.obj)     \
$(CSESSION:.c=.obj)     \
$(CSHARE:.c=.obj)       \
$(CSTATS:.c=.obj)       \
$(CUSE:.c=.obj)         \
$(CUSER:.c=.obj)        \
$(CWKSTA:.c=.obj):      $(HSOURCE)

$(CALERT:.c=.exe)       \
$(CAUDIT:.c=.exe)       \
$(CCHARDEV:.c=.exe)     \
$(CCONFIG:.c=.exe)      \
$(CCONNECT:.c=.exe)     \
$(CDOMAIN:.c=.exe)      \
$(CERROR:.c=.exe)       \
$(CFILE:.c=.exe)        \
$(CGROUP:.c=.exe)       \
$(CHANDLE:.c=.exe)      \
$(CMAILSLOT:.c=.exe)    \
$(CMESSAGE:.c=.exe)     \
$(CNETBIOS:.c=.exe)     \
$(CPIPES:.c=.exe)       \
$(CPRINTJ:.c=.exe)      \
$(CPRINTQ:.c=.exe)      \
$(CPRINTD:.c=.exe)      \
$(CREMOTE:.c=.exe)      \
$(CSERVER:.c=.exe)      \
$(CSERVICE:.c=.exe)     \
$(CSESSION:.c=.exe)     \
$(CSHARE:.c=.exe)       \
$(CSTATS:.c=.exe)       \
$(CUSE:.c=.exe)         \
$(CUSER:.c=.exe)        \
$(CWKSTA:.c=.exe):      $(LIBSRC)

