# WEPS makefile (dmake version 4.1) # Specify desired OS (expected to be read in via environment variables) #OS := DOS #OS := WIN95 #OS := WINNT #OS := UNIX # Specify debug or optimized builds via the $(DEBUG) and $(OPT) macros # in the dmake commandline invocation. For example: # dmake DEBUG=1 # or # dmake OPT=1 .INCLUDE : makefile.inc/prologue.mk # include project master prologue file .IF $(OS) == UNIX .INCLUDE : makefile.inc/unix.mk # include Unix macro file .ELSE .INCLUDE : makefile.inc/watcom.mk # include Watcom macro file .END # list submodel directories (no suffixes in dir names allowed) subdirs = testmain ../../erosion ../../util/math #create a list of subdir variables for their src and obj file lists subdir_src := $(subdirs:f:+"_src") subdir_obj := $(subdirs:f:+"_obj") # create path/names for all subdir library modules # Note: can't seem to autobuild this list either #subdirs_lib := $(subdirs)/$(LIB_PREFIX)$(subdirs:f)$(A) #subdirs_lib = $(foreach i, $(subdirs), $(i)/$(LIB_PREFIX)$(i:f)$(A)) #subdirs_lib = $(foreach i, $(subdirs), $(i)) subdirs_lib += testmain/$(LIB_PREFIX)testmain$(A) subdirs_lib += ../../erosion/$(LIB_PREFIX)erosion$(A) subdirs_lib += ../../util/math/$(LIB_PREFIX)math$(A) # get src files from each of the following subdirectories # and specify all of their corresponding object files # Note: can't seem to do this in a loop yet, so must explicitly list them testmain_src = $(shell +ls testmain/*$(F)) testmain_obj = ${testmain_src:$(F)=$(O)} erosion_src = $(shell +ls ../../erosion/*$(F)) erosion_obj = ${erosion_src:$(F)=$(O)} math_src = $(shell +ls ../../util/math/*$(F)) math_obj = ${math_src:$(F)=$(O)} # prepend paths in macro names for library build recipe to work testmain/testmain_obj = $(testmain_obj) ../../erosion/erosion_obj = $(erosion_obj) ../../util/math/math_obj = $(math_obj) # collate all the src files under one list subdirs_src = $(testmain_src) $(erosion_src) $(math_src) # determine all the corresponding object files subdirs_obj := ${subdirs_src:$(F)=$(O)} # recipes (doesn't yet include library recipes) .INCLUDE : makefile.inc/recipes.mk # include dmake recipe file # list of targets here ERODE: $(BIN)/tsterod$(E) # only one executable for now libs: $(subdirs_lib) # build libraries all: ERODE libs # build "everything" # targets for the library files (dependents must include full path) ${subdirs_lib}: $$($$(@:db:s/$(LIB_PREFIX)//)_obj) $(MAKE_LIB) $(BIN)/tsterod$(E): $(subdirs_obj) $(MAKE_EXE) # these are for test purposes echo: # these are from gnu makefile # echo "The subdirs are: $(subdirs)" # echo "The subdirs_src are: $(subdirs_src)" # echo "The subdirs_obj are: $(subdirs_obj)" # echo "The subdirs_lib are: $(subdirs_lib)" # echo "The subdir_src are: $(subdir_src)" # echo "The subdir_obj are: $(subdir_obj)" # echo "asd_src: $(asd_src)" # echo "asd_obj: $(asd_obj)" # echo "math_src: $(math_src)" # echo "math_obj: $(math_obj)" # echo "Testing: $(UTIL/MATH)" clean: -rm bin/tsterod$(E) -rm $(subdirs_obj) -rm $(subdirs_lib) clobber: clean