#       SCCSID = @(#)makesub.inc        6.1 90/11/28

#**     makefile for dos subdirectories
#       to be included AFTER the first makefile target

#       variables to be defined by the outer level makefile:
#       SUBDIR       - dev, filesys, etc.
#       INC          - auxiliary files
#       NBJ     .obj - non-debug objects
#       OBJ     .obj - common debug/non-debug objects
#       SRC     .doc - top level document source files
#       DOC          - auxiliary doc files
#       PVOBJ        - PerfView objects, all flavors (2) always built
#       PVNBJ        - PerfView debugging objects, all flavors (4) always built

MBJ=    $(NBJ:.obj=.rbj)
DBJ=    $(NBJ:.obj=.dbj)
BBJ=    $(NBJ:.obj=.bbj)
PV=     $(PVOBJ) $(PVNBJ) $(PVOBJ:.obj=.rbj) $(PVNBJ:.obj=.rbj) \
        $(PVNBJ:.obj=.dbj) $(PVNBJ:.obj=.bbj)

RBJ=    $(OBJ:.obj=.rbj)

#       Rules for building libraries for this directory:

lib:    strict retail

strict: $(SUBDIR)o.lib $(SUBDIR)n.lib $(SUBDIR)d.lib
retail: $(SUBDIR)r.lib $(SUBDIR)m.lib $(SUBDIR)b.lib

$(SUBDIR)o.lib: $(OBJ) inc $(PV)
$(SUBDIR)n.lib: $(NBJ) inc $(PV)
$(SUBDIR)d.lib: $(DBJ) inc $(PV)
$(SUBDIR)r.lib: $(RBJ) inc $(PV)
$(SUBDIR)m.lib: $(MBJ) inc $(PV)
$(SUBDIR)b.lib: $(BBJ) inc $(PV)

MAKEFILES=      makefile ../makefile.inc ../makesub.inc

$(SUBDIR)o.lrf: $(MAKEFILES)
        rem <<$(SUBDIR)o.lrf
$(SUBDIR)o.tmp /p:32
y
$(OBJ:  = &^
);
<<keep

$(SUBDIR)n.lrf: $(MAKEFILES)
        rem <<$(SUBDIR)n.lrf
$(SUBDIR)n.tmp /p:32
y
$(NBJ:  = &^
);
<<keep

$(SUBDIR)d.lrf: $(MAKEFILES)
        rem <<$(SUBDIR)d.lrf
$(SUBDIR)d.tmp /p:32
y
$(DBJ:  = &^
);
<<keep

$(SUBDIR)r.lrf: $(MAKEFILES)
        rem <<$(SUBDIR)r.lrf
$(SUBDIR)r.tmp /p:32
y
$(RBJ:  = &^
);
<<keep

$(SUBDIR)m.lrf: $(MAKEFILES)
        rem <<$(SUBDIR)m.lrf
$(SUBDIR)m.tmp /p:32
y
$(MBJ:  = &^
);
<<keep

$(SUBDIR)b.lrf: $(MAKEFILES)
        rem <<$(SUBDIR)b.lrf
$(SUBDIR)b.tmp /p:32
y
$(BBJ:  = &^
);
<<keep


HPL=    $(SRC:.doc=.hpl)
HP2=    $(SRC:.doc=.hp2)
PPR=    $(SRC:.doc=.ppr)
PPX=    $(SRC:.doc=.ppx)
TXT=    $(SRC:.doc=.txt)

doc:    ppr $(DOC)

txt:    $(TXT)
hpl:    $(HPL)
hp2:    $(HP2)
ppr:    $(PPR)
ppx:    $(PPX)

inc:    $(INC)

cleaninc:
        -del $(INC) > nul 2>&1

clean:
        -del $(INC) $(CLEAN) $(CLEANSUB) > nul 2>&1

depend: inc
        sed "/^# Dependencies follow/,/^# see depend: above/D" makefile > makefile.new
        echo # Dependencies follow>> makefile.new
        includes $(INCEXT) $(AINC) *.asm >> makefile.new
        includes $(INCEXT) $(CINC) *.c >> makefile.new
        echo # IF YOU PUT STUFF HERE IT WILL GET BLASTED>> makefile.new
        echo # see depend: above>> makefile.new
        copy makefile makefile.old
        copy makefile.new makefile
        $(SKIP) del makefile.new
