*** empty log message ***

This commit is contained in:
David Rose 2000-10-05 22:34:32 +00:00
parent 0384b5f5a0
commit 1a2d2a8324
11 changed files with 1611 additions and 0 deletions

View File

@ -0,0 +1,249 @@
#
# Makefile rules for compiling Alias static (non-character) models
# into egg, and then into pfb's (or something). This is useful
# for things which are not characters but are modeled in Alias.
#
include $(DTOOL)/inc/Makefile.inst-egg.vars
ifeq ($(A2E),)
A2E = a2egg
endif
ifeq ($(EGG_RESTRUCTURE),)
EGG_RESTRUCTURE = egg-restructure
endif
ifeq ($(EGG_PALETTIZE),)
EGG_PALETTIZE = egg-palettize
endif
ifeq ($(EGG_COMBINE),)
EGG_COMBINE = egg-combine
endif
ifeq ($(EGG_TEXTURES),)
EGG_TEXTURES = egg-textures
endif
ifeq ($(PFICONV),)
PFICONV = pficonv -m
endif
ifeq ($(INSTALL_DIR),)
INSTALL_DIR = $(INSTALL_ROOT)/models/$(SCENE_DIR)
endif
ifeq ($(EGG_NAME),)
EGG_NAME = $(SCENE)
endif
ifeq ($(DIR_NAME),)
DIR_NAME = $(CHAR_NAME)
endif
ifeq ($(ALIAS_VERSION),7)
VERSION_SUFFIX = -v7
endif
ifeq ($(WIRE_NAME),)
WIRE_NAME = $(CHAR_NAME)
endif
ifeq ($(WIRE_PATTERN),)
WIRE_PATTERN = $(WIRE_NAME)*.wire
endif
ifeq ($(WIRE_DIR),)
ifeq ($(MODEL_TYPE),)
WIRE_DIR = $(ALIAS_SOURCE_ROOT)/models/$(DIR_NAME)
else
WIRE_DIR = $(ALIAS_SOURCE_ROOT)/models/$(DIR_NAME)/$(MODEL_TYPE)
endif
endif
ifeq ($(BUILD_MODELS),)
BUILD_MODELS = $(EGG_NAME)
endif
ifeq ($(SCENE_DIR),)
SCENE_DIR = snarf
endif
ifeq ($(PFI_DIR),)
PFI_DIR = $(FLT_PFI_DIR)
endif
# This helps out some of the generic option variables that are used for
# both chars and scenes.
CHAR_NAME = $(SCENE)
# WIRE_DIR and WIRE_PATTERN tell the makefile where to find the latest model
# file.
ifneq ($(WIRE_DIR),)
ifneq ($(WIRE_PATTERN),)
WIRE_FILE := $(strip $(shell cd $(WIRE_DIR); findlatest $(WIRE_DIR) $(WIRE_PATTERN)))
endif
endif
# If we have RESTRUCTURE_OPTS set, then we must generate the model file into
# the unstructure directory, and restructure it into the current directory.
# Otherwise, we just generate it directly into the current directory.
ifneq ($(RESTRUCTURE_OPTS),)
INIT_EGG_DIR = unstructure
UNPAL_EGG_DIR = $(SCENE_DIR)
else
INIT_EGG_DIR = $(SCENE_DIR)
UNPAL_EGG_DIR = $(SCENE_DIR)
endif
ifneq ($(PALETTIZE_OPTS),)
PAL_EGG_DIR = pal
else
PAL_EGG_DIR = $(UNPAL_EGG_DIR)
endif
ifneq ($(MAKE_PFI),)
PFI_EGG_DIR = pfi
EGG2INST_OPTS = -t
else
PFI_EGG_DIR = $(PAL_EGG_DIR)
endif
# INSTALL_FROM_DIR is the name of the subdirectory from which the final
# egg files will be installed. If unspecified, it defaults to either
# PAL_EGG_DIR or PFI_EGG_DIR, depending on whether pfi's are built. This
# can be used to apply a last-minute operation on the egg file within the
# makefile.
ifeq ($(INSTALL_FROM_DIR),)
INSTALL_FROM_DIR = $(PFI_EGG_DIR)
endif
# BUILD_NAMES is the filename, without directory, of each of BUILD_MODELS.
# Often this will be the same, but it is allowed to specified a relative
# filename on each BUILD_MODEL.
BUILD_NAMES := $(notdir $(BUILD_MODELS))
INIT_EGG_FILES := $(patsubst %,$(INIT_EGG_DIR)/%.egg,$(BUILD_MODELS))
UNPAL_EGG_FILES := $(patsubst %,$(UNPAL_EGG_DIR)/%.egg,$(BUILD_MODELS))
PAL_EGG_FILES := $(patsubst %,$(PAL_EGG_DIR)/%.egg,$(BUILD_NAMES))
PFI_EGG_FILES := $(patsubst %,$(PFI_EGG_DIR)/%.egg,$(BUILD_NAMES))
INSTALL_INST_FILES := $(patsubst %,$(INSTALL_DIR)/%.$(INST),$(BUILD_NAMES))
ifneq ($(PALETTIZE_TOGETHER),)
# If we only have one file, don't attempt to palettize it together with
# itself. PALETTIZE_TOGETHER only makes sense if we have multiple files.
ifeq ($(words $(PAL_EGG_FILES)),1)
PALETTIZE_TOGETHER :=
endif
endif
.PHONY: egg pfb clean cleanall all_dirs
egg: all_dirs $(UNPAL_EGG_FILES)
pfb: egg $(INSTALL_INST_FILES)
all_dirs: maps $(SCENE_DIR) $(INSTALL_DIR)
ifneq ($(RESTRUCTURE_OPTS),)
all_dirs: unstructure
endif
ifneq ($(PALETTIZE_OPTS),)
all_dirs: pal
endif
ifneq ($(MAKE_PFI),)
all_dirs: pfi $(PFI_DIR)
endif
# This is the basic rule. If the including makefile doesn't specify anything
# else, we use this rule to build our egg file.
$(INIT_EGG_DIR)/%.egg : $(WIRE_FILE)
$(A2E) $(A2E_OPTS) -m $@ $(WIRE_FILE)
#
# Restructuring.
#
ifneq ($(RESTRUCTURE_OPTS),)
$(UNPAL_EGG_FILES) : $(UNPAL_EGG_DIR)/%.egg : $(INIT_EGG_DIR)/%.egg
$(EGG_RESTRUCTURE) -o $@ $(RESTRUCTURE_OPTS) $<
endif
#
# Palettizing.
#
ifneq ($(PALETTIZE_OPTS),)
ifneq ($(PALETTIZE_TOGETHER),)
# If there are multiple files and the user so requested, palettize them all
# together.
$(UNPAL_EGG_DIR)/$(EGG_NAME)-combine.egg : $(UNPAL_EGG_FILES)
$(EGG_COMBINE) -o $@ $^
$(PAL_EGG_DIR)/$(EGG_NAME)-combine.egg : $(UNPAL_EGG_DIR)/$(EGG_NAME)-combine.egg
$(EGG_PALETTIZE) -o $@ $(PALETTIZE_OPTS) -p $(EGG_NAME)-palette. $<
$(PAL_EGG_FILES) : $(PAL_EGG_DIR)/$(EGG_NAME)-combine.egg
$(EGG_COMBINE) -x -p $(PAL_EGG_DIR)/ $<
else
# If there's only one file, or the user didn't request a group palettizing,
# palettize them separately.
ifeq ($(BUILD_MODELS),$(BUILD_NAMES))
# If none of the build models had directories, we can do it this way.
$(PAL_EGG_FILES) : $(PAL_EGG_DIR)/%.egg : $(UNPAL_EGG_DIR)/%.egg
$(EGG_PALETTIZE) -o $@ $(PALETTIZE_OPTS) -p $(patsubst $(PAL_EGG_DIR)/%.egg,%,$@)-palette. $<
else
# Otherwise, we have an error. Don't put a rule for the palettized files,
# so the make will stop.
endif
endif
endif
ifneq ($(MAKE_PFI),)
$(PFI_EGG_FILES) : $(PFI_EGG_DIR)/%.egg : $(PAL_EGG_DIR)/%.egg
$(EGG_TEXTURES) -o $@ -d $(PFI_DIR)/$(PFI_PREFIX) -e pfi -n -p "$(PFICONV) %o %n" $<
endif
$(INSTALL_INST_FILES) : $(INSTALL_DIR)/%.$(INST) : $(INSTALL_FROM_DIR)/%.egg
$(INSTALL_EGG_ACTION)
clean:
# Not really much we can do here.
cleanall: clean
# Or here.
unstructure:
mkdir unstructure
pal:
mkdir pal
pfi:
mkdir pfi
maps:
mkdir maps
ifneq ($(SCENE_DIR),.)
$(SCENE_DIR) :
mkdir -p $@
endif
$(INSTALL_DIR) :
mkdir -p $@
ifneq ($(PFI_DIR),$(INSTALL_DIR))
$(PFI_DIR) :
mkdir -p $@
endif
show-wire-files:
@echo WIRE_DIR is $(WIRE_DIR)
@echo WIRE_PATTERN is $(WIRE_PATTERN)
@echo WIRE_FILE is $(WIRE_FILE)

View File

@ -0,0 +1,55 @@
#
# Makefile rules for compiling Alias character models.
#
ifeq ($(ALIAS_VERSION),7)
VERSION_SUFFIX = -v7
endif
ifeq ($(WIRE_NAME),)
WIRE_NAME = $(CHAR_NAME)
endif
ifeq ($(WIRE_PATTERN),)
WIRE_PATTERN = $(WIRE_NAME)*.wire
endif
ifeq ($(WIRE_DIR),)
ifeq ($(MODEL_TYPE),)
WIRE_DIR = $(ALIAS_SOURCE_ROOT)/models/$(DIR_NAME)
else
WIRE_DIR = $(ALIAS_SOURCE_ROOT)/models/$(DIR_NAME)/$(MODEL_TYPE)
endif
endif
ifeq ($(CHAN_DIR),)
CHAN_DIR = $(ALIAS_SOURCE_ROOT)/channels/$(DIR_NAME)/$(ANIM)
endif
ifneq ($(TESS_LEVELS)$(QTESS_LEVELS),)
# If we are tesselating, we must force the nurbs model generation.
ifeq ($(NURBS_OPTS),)
NURBS_OPTS = $(A2E_OPTS)
endif
endif
# We'll always use version 8 a2egg to get out the static model. Version 7
# has some problems with clusters.
A2EGG = a2egg$(VERSION_SUFFIX)
# But we'll use version 7, if requested, to get out the animation, which is
# necessary for some version 7 animations.
A2EGG_CHAN = a2egg-chan$(VERSION_SUFFIX)
MAKE_POLY_MODEL = a2egg -m $@ $(POLY_OPTS) $(WIRE_FILE)
MAKE_NURBS_MODEL = a2egg -n -s -m $@ $(NURBS_OPTS) $(WIRE_FILE)
A2E_RULE = $(UNOPT)$(EGG_NAME)-$(MODEL).egg : $(WIRE_FILE)
A2E = $(A2EGG) -m $@ $(A2E_OPTS)
A2C_RULE = $(UNOPT)$(CHAN_FILE_PREFIX)$(ANIM)$(CHAN_FILE_SUFFIX).egg : $(FIND_CHAN_FILES)
A2C = $(A2EGG_CHAN) -c $@ $(A2C_OPTS)
include $(DTOOL)/inc/Makefile.char-egg.rules

View File

@ -0,0 +1,533 @@
#
# Makefile rules for compiling Alias or SoftImage character models into egg,
# and then into pfb's.
#
include $(DTOOL)/inc/Makefile.inst-egg.vars
ifeq ($(EGG_PALETTIZE),)
EGG_PALETTIZE = egg-palettize
endif
ifeq ($(EGG_TEXTURES),)
EGG_TEXTURES = egg-textures
endif
ifeq ($(PFICONV),)
PFICONV = pficonv -m
endif
ifeq ($(PFI_DIR),)
PFI_DIR = $(CHAR_PFI_DIR)
endif
ifeq ($(QTESS),)
QTESS = qtess $(QTESS_OPTS)
endif
ifeq ($(TESS),)
TESS = tess $(TESS_OPTS)
endif
ifeq ($(EGG_BLEND),)
EGG_BLEND = egg-blend $(EGG_BLEND_OPTS)
endif
ifeq ($(EGG_REPLACE),)
EGG_REPLACE = egg-replace $(EGG_REPLACE_OPTS)
endif
ifeq ($(EGG_REPLACE_OPTS),)
EGG_REPLACE_OPTS = -n
endif
ifeq ($(INSTALL_DIR),)
INSTALL_DIR = $(INSTALL_ROOT)/models/char/$(DIR_NAME)
endif
ifeq ($(INSTALL_MAP_DIR),)
INSTALL_MAP_DIR = $(INSTALL_DIR)/$(INSTALL_MAPS)
endif
ifeq ($(DIR_NAME),)
DIR_NAME = $(CHAR_NAME)
endif
# A synonym to help palettize find a reasonable default palette name.
SCENE = $(DIR_NAME)
ifeq ($(EGG_NAME),)
EGG_NAME = $(CHAR_NAME)
endif
ifeq ($(CHAR_TOP_NODE),)
CHAR_TOP_NODE = $(CHAR_NAME)
endif
ifneq ($(PALETTE_NAME),)
# If the palette name is nonempty, make sure it doesn't contain slashes.
PALETTE_NAME := $(subst /,-,$(PALETTE_NAME))
endif
PAL_EGG_DIR = $(CHAR_BUILD_DIR)/pal
# WIRE_DIR and WIRE_PATTERN tell the makefile where to find the latest model
# file.
ifneq ($(WIRE_DIR),)
ifneq ($(WIRE_PATTERN),)
WIRE_FILE := $(strip $(shell cd $(WIRE_DIR); findlatest $(WIRE_DIR) $(WIRE_PATTERN)))
endif
endif
# TX_WIRE_DIR and TX_WIRE_PATTERN tell where to find the latest model for the
# texture substitution. If this is non-null, it will use this file to
# substitute pieces in when it builds the NURBS file. This is a hack to
# work around the Alias/SoftImage texture offset problem.
ifneq ($(TX_WIRE_DIR),)
ifneq ($(TX_WIRE_PATTERN),)
TX_WIRE_FILE := $(strip $(shell cd $(TX_WIRE_DIR); findlatest $(TX_WIRE_DIR) $(TX_WIRE_PATTERN)))
endif
endif
ifneq ($(CHAN_DIR),)
FIND_CHAN_FILES = $(foreach pat,$(CHAN_PATTERN),$(foreach dir,$(CHAN_DIR),$(strip $(shell cd $(dir); findlatest $(dir) $(pat)))))
endif
# If the user didn't give us an explicit directory to place the unoptimized
# models--normally $(UNOPT)--infer it.
ifeq ($(UNOPT),)
ifneq ($(OPTCHAR_OPTS),)
UNOPT = unopt/
endif
endif
# And, we might even want to make a second pass at optcharring.
ifeq ($(UNOPT2),)
ifneq ($(OPTCHAR2_OPTS),)
UNOPT2 = unopt2/
endif
endif
# Set UNOPT2_NAME to be the printable name of UNOPT2.
ifeq ($(UNOPT2),)
UNOPT2_NAME = .
else
UNOPT2_NAME = $(UNOPT2)
endif
# We need this variable in a substitution below.
comma := ,
ifeq ($(POLY_MODEL_FILE),)
POLY_MODEL_FILE = $(EGG_NAME)-mod.egg
endif
ifeq ($(NURBS_MODEL_FILE),)
NURBS_MODEL_FILE = $(EGG_NAME)-nurbs.egg
endif
# We define two different variables, NURBS_MODEL_READ and
# NURBS_MODEL_WRITE, to allow inserting of a user step in the build
# process between writing a final NURBS model and processing it.
# Normally, these variables are the same; if the user makefile defines
# them different, it can establish the processing to generate one from
# the other.
ifeq ($(NURBS_MODEL_READ),)
NURBS_MODEL_READ = $(NURBS_MODEL_FILE)
endif
ifeq ($(NURBS_MODEL_WRITE),)
NURBS_MODEL_WRITE = $(NURBS_MODEL_FILE)
endif
# Similarly for POLY_MODEL_READ and POLY_MODEL_WRITE.
ifeq ($(POLY_MODEL_READ),)
POLY_MODEL_READ = $(POLY_MODEL_FILE)
endif
ifeq ($(POLY_MODEL_WRITE),)
POLY_MODEL_WRITE = $(POLY_MODEL_FILE)
endif
TX_EGG_FILE = $(EGG_NAME)-tx.egg
PRETX_EGG_FILE = $(EGG_NAME)-pretx.egg
# ANIMS is the list of anim files. These are passed through optchar.
CHAN_FILES := $(patsubst %,$(CHAN_FILE_PREFIX)%$(CHAN_FILE_SUFFIX).egg,$(ANIMS))
# ANIMS2 is the list of anim files that are passed through the second round
# of optchar, if there is one. If ANIMS2 is left unspecified, the user
# may specify simply BLEND_ANIMS, which is concatenated on the end.
ifneq ($(ANIMS2),)
CHAN2_FILES := $(patsubst %,$(CHAN_FILE_PREFIX)%$(CHAN_FILE_SUFFIX).egg,$(ANIMS2))
else
CHAN2_FILES := $(CHAN_FILES) $(patsubst %,$(CHAN_FILE_PREFIX)%$(CHAN_FILE_SUFFIX).egg,$(BLEND_ANIMS))
endif
MODEL_FILES_READ = $(MODEL_FILES)
MODEL_FILES_WRITE = $(MODEL_FILES)
ifneq ($(POLY_OPTS),)
MODEL_FILES_READ += $(POLY_MODEL_READ)
MODEL_FILES_WRITE += $(POLY_MODEL_WRITE)
endif
# Maybe we have a list of additional models that are built by separate
# makefiles, but are intended to be optcharred in with the primary
# model.
ifneq ($(AUX_MODELS),)
UNOPT_AUX_MODELS := $(patsubst %,$(UNOPT)%.egg,$(AUX_MODELS))
OPT_AUX_MODELS := $(patsubst %,%.egg,$(AUX_MODELS))
endif
ifneq ($(LODS),)
# If LODS is set, assume it's a list of models that will be compiled
# into a single multiple-lod model.
LOD_EGG_FILES := $(patsubst %,$(UNOPT)$(EGG_NAME)-%.egg,$(LODS))
MODEL_FILES_READ := $(patsubst $(UNOPT)%,%,$(POLY_MODEL_READ))
MODEL_FILES_WRITE := $(patsubst $(UNOPT)%,%,$(POLY_MODEL_WRITE))
LOD_DF :=
ifneq ($(LOD_DIST),)
LOD_DF += -d $(LOD_DIST)
endif
ifneq ($(LOD_FADE),)
LOD_DF += -f $(LOD_FADE)
endif
# If we're building a multiple-lod model, we might want to consider
# different TESS options.
ifneq ($(TESS_LEVELS),)
TESS_MODELS := $(patsubst %,$(UNOPT)$(EGG_NAME)-%.egg,$(TESS_LEVELS))
endif
ifneq ($(QTESS_LEVELS),)
QTESS_MODELS := $(patsubst %,$(UNOPT)$(EGG_NAME)-%.egg,$(QTESS_LEVELS))
endif
else
# Ok, we're not building a multiple-lod model. We're either building
# several distinct models, or a single NURBS model.
MODEL_FILES_READ += $(OPT_AUX_MODELS)
MODEL_FILES_WRITE += $(OPT_AUX_MODELS)
ifneq ($(TESS_LEVELS),)
# One or more TESS'ed model.
TESS_MODELS := $(patsubst %,$(UNOPT)$(EGG_NAME)-%.egg,$(TESS_LEVELS))
MODEL_FILES_READ += $(patsubst $(UNOPT)%,%,$(TESS_MODELS))
MODEL_FILES_WRITE += $(patsubst $(UNOPT)%,%,$(TESS_MODELS))
else
ifneq ($(QTESS_LEVELS),)
# One or more QTESS'ed model.
QTESS_MODELS := $(patsubst %,$(UNOPT)$(EGG_NAME)-%.egg,$(QTESS_LEVELS))
MODEL_FILES_READ += $(patsubst $(UNOPT)%,%,$(QTESS_MODELS))
MODEL_FILES_WRITE += $(patsubst $(UNOPT)%,%,$(QTESS_MODELS))
else
ifneq ($(NURBS_OPTS),)
# No particular tesselation parameters, but the user still asked for
# a NURBS file. He must really want to install it.
MODEL_FILES_READ += $(NURBS_MODEL_READ)
MODEL_FILES_WRITE += $(NURBS_MODEL_WRITE)
endif
endif
endif
endif
# Now that we've built up the list of MODEL_FILES, give the user a chance
# to override it. These are the egg files that get passed through optchar.
ifneq ($(BUILD_MODELS),)
MODEL_FILES_READ := $(patsubst %,$(EGG_NAME)-%.egg,$(BUILD_MODELS))
MODEL_FILES_WRITE := $(patsubst %,$(EGG_NAME)-%.egg,$(BUILD_MODELS))
endif
# And the user might always have some extra ones.
ifneq ($(EXTRA_MODELS),)
MODEL_FILES_READ += $(patsubst %,$(EGG_NAME)-%.egg,$(EXTRA_MODELS))
MODEL_FILES_WRITE += $(patsubst %,$(EGG_NAME)-%.egg,$(EXTRA_MODELS))
endif
# If the user specified BUILD2_MODELS, these are files that get passed
# through optchar the second time (if there is a second optchar pass).
# Otherwise, we'll infer it as well.
ifneq ($(BUILD2_MODELS),)
MODEL2_FILES := $(patsubst %,$(EGG_NAME)-%.egg,$(BUILD2_MODELS))
else
MODEL2_FILES := $(MODEL_FILES_READ)
endif
# Similarly for extras.
ifneq ($(EXTRA2_MODELS),)
MODEL2_FILES += $(patsubst %,$(EGG_NAME)-%.egg,$(EXTRA2_MODELS))
endif
QTESS_RULE = $(UNOPT)$(EGG_NAME)-$(MODEL).egg : $(UNOPT)$(NURBS_MODEL_READ)
# This is largely unnecessary, because of $(TESS_MODELS).
TESS_RULE = $(UNOPT)$(EGG_NAME)-$(MODEL).egg : $(UNOPT)$(NURBS_MODEL_READ)
BLEND_RULE = $(UNOPT2)$(CHAN_FILE_PREFIX)$(word 1,$(ANIM))-$(word 2,$(ANIM))$(word 3,$(ANIM))$(CHAN_FILE_SUFFIX).egg : $(patsubst %,$(UNOPT2)$(CHAN_FILE_PREFIX)%$(CHAN_FILE_SUFFIX).egg,$(word 1,$(ANIM)) $(word 2,$(ANIM)))
ifneq ($(COLLAPSED_ANIM),)
COLLAPSED_CHAN_FILE = $(EGG_NAME)-$(COLLAPSED_ANIM).egg
ifneq ($(OPTCHAR_OPTS),)
OPTCHAR_OPTS += -c $(COLLAPSED_CHAN_FILE)
endif
OPT_MODEL_FILES = $(patsubst %,$(UNOPT2)%,$(MODEL_FILES_READ)
OPT_CHAN_FILES = $(COLLAPSED_CHAN_FILE))
OPT2_MODEL_FILES = $(MODEL2_FILES)
OPT2_CHAN_FILES = $(COLLAPSED_CHAN_FILE)
else
OPT_MODEL_FILES = $(patsubst %,$(UNOPT2)%,$(MODEL_FILES_READ))
OPT_CHAN_FILES = $(patsubst %,$(UNOPT2)%,$(CHAN_FILES))
OPT2_MODEL_FILES = $(MODEL2_FILES)
OPT2_CHAN_FILES = $(CHAN2_FILES)
endif
OPT_EGG_FILES = $(OPT_MODEL_FILES) $(OPT_CHAN_FILES)
OPT2_EGG_FILES = $(OPT2_MODEL_FILES) $(OPT2_CHAN_FILES)
UNOPT2_EGG_FILES = $(patsubst %,$(UNOPT2)%,$(OPT2_EGG_FILES))
ifneq ($(INSTALL_MODELS),)
# If the user gave us a custom list of eggs to install, respect it. These
# are the egg files--models, in this case--that get converted to pfb's
# or whatever.
INSTALL_MODEL_FILES := $(patsubst %,$(EGG_NAME)-%.egg,$(INSTALL_MODELS))
else
# Otherwise, infer it.
INSTALL_MODEL_FILES := $(OPT2_MODEL_FILES)
endif
ifneq ($(INSTALL_ANIMS),)
# Same story with the anims.
INSTALL_CHAN_FILES := $(patsubst %,$(CHAN_FILE_PREFIX)%.egg,$(INSTALL_ANIMS))
else
# Otherwise, infer it.
INSTALL_CHAN_FILES := $(OPT2_CHAN_FILES)
endif
INSTALL_EGG_FILES = $(INSTALL_MODEL_FILES) $(INSTALL_CHAN_FILES)
PAL_MODEL_FILES := $(patsubst %,$(PAL_EGG_DIR)/%,$(INSTALL_MODEL_FILES))
INSTALL_INST_MODEL_FILES := $(patsubst %.egg,$(INSTALL_DIR)/%.$(INST),$(INSTALL_MODEL_FILES))
INSTALL_INST_CHAN_FILES := $(patsubst %.egg,$(INSTALL_DIR)/%.$(INST),$(INSTALL_CHAN_FILES))
INSTALL_INST_FILES = $(INSTALL_INST_MODEL_FILES) $(INSTALL_INST_CHAN_FILES)
ifneq ($(INSTALL_MAPS),)
EXTRA_INSTALL_TARGET := install-maps
EXTRA_UNINSTALL_TARGET := uninstall-maps
endif
UNOPT_MODEL_FILES_READ := $(patsubst %,$(UNOPT)%,$(MODEL_FILES_READ))
UNOPT_MODEL_FILES_WRITE := $(patsubst %,$(UNOPT)%,$(MODEL_FILES_WRITE))
UNOPT_CHAN_FILES := $(patsubst %,$(UNOPT)%,$(CHAN_FILES))
UNOPT_EGG_FILES_READ := $(UNOPT_MODEL_FILES_READ) $(UNOPT_CHAN_FILES)
UNOPT_EGG_FILES_WRITE := $(UNOPT_MODEL_FILES_WRITE) $(UNOPT_CHAN_FILES)
.PHONY: egg pfb all_dirs check-palette
.PHONY: install-maps uninstall-maps
.PHONY: realinstall uninstall clean cleanall
.PHONY: $(addprefix uninstall-,$(INSTALL_INST_FILES))
egg: $(UNOPT) all_dirs $(INSTALL_EGG_FILES)
pfb: $(UNOPT) all_dirs check-palette $(INSTALL_INST_FILES) $(EXTRA_INSTALL_TARGET)
all_dirs: maps $(INSTALL_DIR) $(UNOPT) $(UNOPT2)
ifneq ($(PALETTE_NAME),)
all_dirs: $(PAL_EGG_DIR)
endif
realinstall: pfb
uninstall: $(addprefix uninstall-,$(INSTALL_INST_FILES)) $(EXTRA_UNINSTALL_TARGET)
$(addprefix uninstall-,$(INSTALL_INST_FILES)) : uninstall-% :
rm -f $(patsubst uninstall-%,%,$@)
clean:
rm -f $(sort $(OPT_EGG_FILES) $(LOD_EGG_FILES) $(INSTALL_EGG_FILES))
rm -f $(sort $(UNOPT_EGG_FILES_READ) $(UNOPT_EGG_FILES_WRITE) $(UNOPT)$(NURBS_MODEL_READ) $(UNOPT)$(NURBS_MODEL_WRITE))
rm -f $(EXTRA_DIRT) maps/*
ifneq ($(TX_WIRE_FILE),)
rm -f $(UNOPT)$(PRETX_EGG_FILE) $(UNOPT)$(TX_EGG_FILE)
endif
ifneq ($(OPTCHAR2_OPTS),)
rm -f $(OPT2_EGG_FILES)
rm -f $(UNOPT2_EGG_FILES)
endif
cleanall: clean
$(INSTALL_DIR):
mkdir -p $(INSTALL_DIR)
ifneq ($(LODS),)
# Make the unoptimized multiple-lod file
$(UNOPT)$(POLY_MODEL_WRITE) : $(LOD_EGG_FILES)
egg-lod $(LOD_OPTS) $(LOD_DF) -o $@ $(patsubst %,%$(comma)$(CHAR_TOP_NODE),$< $^)
else
ifneq ($(POLY_OPTS),)
# Make the unoptimized model file
ifeq ($(TX_WIRE_FILE),)
# Make the poly file the normal way, directly.
$(UNOPT)$(POLY_MODEL_WRITE) : $(WIRE_FILE)
$(MAKE_POLY_MODEL)
else
# Make the poly file via the TX_WIRE_FILE.
$(UNOPT)$(TX_EGG_FILE) : $(TX_WIRE_FILE)
$(MAKE_TX_MODEL)
$(UNOPT)$(PRETX_EGG_FILE) : $(WIRE_FILE)
$(MAKE_POLY_MODEL)
$(UNOPT)$(POLY_MODEL_WRITE) : $(UNOPT)$(PRETX_EGG_FILE) $(UNOPT)$(TX_EGG_FILE)
$(EGG_REPLACE) -o $@ $^
endif
endif
endif
ifneq ($(NURBS_OPTS),)
# Make the nurbs model file
ifeq ($(TX_WIRE_FILE),)
# Make the nurbs file the normal way, directly.
$(UNOPT)$(NURBS_MODEL_WRITE) : $(WIRE_FILE)
$(MAKE_NURBS_MODEL)
else
# Make the nurbs file via the TX_WIRE_FILE.
$(UNOPT)$(TX_EGG_FILE) : $(TX_WIRE_FILE)
$(MAKE_TX_MODEL)
$(UNOPT)$(PRETX_EGG_FILE) : $(WIRE_FILE)
$(MAKE_NURBS_MODEL)
$(UNOPT)$(NURBS_MODEL_WRITE) : $(UNOPT)$(PRETX_EGG_FILE) $(UNOPT)$(TX_EGG_FILE)
$(EGG_REPLACE) -o $@ $^
endif
endif
# Make the tesselated files.
ifneq ($(TESS_MODELS),)
$(TESS_MODELS) : $(UNOPT)%.egg : %.tess $(UNOPT)$(NURBS_MODEL_READ)
$(TESS) $(UNOPT)$(NURBS_MODEL_READ) $< >$@
endif
# Make the tesselated files.
ifneq ($(QTESS_MODELS),)
$(QTESS_MODELS) : $(UNOPT)%.egg : %.qtess $(UNOPT)$(NURBS_MODEL_READ)
$(QTESS) -iq $< -o $@ $(UNOPT)$(NURBS_MODEL_READ)
endif
# Make the auxiliary models, model files whose build commands are
# handled in a separate makefile.
ifneq ($(UNOPT_AUX_MODELS),)
$(UNOPT_AUX_MODELS) : $(UNOPT)%.egg : Makefile.%
$(MAKE) -f $< $@
endif
ifneq ($(OPTCHAR_OPTS),)
# Make the optimized files.
$(OPT_EGG_FILES) : $(UNOPT_EGG_FILES_READ)
egg-optchar -d $(UNOPT2_NAME) $(OPTCHAR_OPTS) $^
else
ifneq ($(COLLAPSED_CHAN_FILE),)
# Ok, we're not optcharing, but we do need to collapse some chan files.
$(COLLAPSED_CHAN_FILE) : $(CHAN_FILES)
egg-optchar -c $(COLLAPSED_CHAN_FILE) $(CHAN_FILES)
endif
endif
ifneq ($(OPTCHAR2_OPTS),)
# Make the optimized files again.
$(OPT2_EGG_FILES) : $(UNOPT2_EGG_FILES)
egg-optchar -d . $(OPTCHAR2_OPTS) $^
endif
ifneq ($(PALETTE_NAME),)
# Palettize the files as we install them.
PT_FILES := $(patsubst %.egg,%.pt,$(INSTALL_MODEL_FILES))
$(PT_FILES) : %.pt : %.egg
touch $@
# Attempt to regularize the cwd.
DIRNAME=$(notdir $(shell pwd))
PWD=$(CHAR_BUILD_DIR)/$(DIRNAME)
$(PAL_MODEL_FILES) : $(PT_FILES)
$(EGG_PALETTIZE) -t -de $(PAL_EGG_DIR) -dm $(INSTALL_ROOT)/maps $(PALETTIZE_OPTS) $(TEXATTRIB_DIR)/$(PALETTE_NAME).txa $(patsubst %.pt,$(PWD)/%.egg,$^)
$(INSTALL_INST_MODEL_FILES) : $(INSTALL_DIR)/%.$(INST) : $(PAL_EGG_DIR)/%.egg
$(INSTALL_EGG_ACTION)
else
# Don't palettize.
$(INSTALL_INST_MODEL_FILES) : $(INSTALL_DIR)/%.$(INST) : %.egg
$(INSTALL_EGG_ACTION)
endif
$(INSTALL_INST_CHAN_FILES) : $(INSTALL_DIR)/%.$(INST) : %.egg
$(INSTALL_EGG_ACTION)
$(PAL_EGG_DIR):
mkdir $(PAL_EGG_DIR)
maps:
mkdir maps
ifneq ($(UNOPT),)
$(UNOPT):
mkdir $(UNOPT)
ln -s ../maps $(UNOPT)maps
endif
ifneq ($(UNOPT2),)
$(UNOPT2):
mkdir $(UNOPT2)
ln -s ../maps $(UNOPT2)maps
endif
ifneq ($(PALETTE_NAME),)
check-palette: $(TEXATTRIB_DIR)/$(PALETTE_NAME).pi
$(TEXATTRIB_DIR)/$(PALETTE_NAME).pi : $(TEXATTRIB_DIR)/$(PALETTE_NAME).txa
$(EGG_PALETTIZE) -t $(PALETTIZE_OPTS) $<
$(TEXATTRIB_DIR)/$(PALETTE_NAME).txa :
@echo $@
else
check-palette:
endif
show-chan-files:
@echo CHAN_DIR is $(CHAN_DIR)
@echo CHAN_PATTERN is $(CHAN_PATTERN)
@echo CHAN_FILES is $(CHAN_FILES)
@echo FIND_CHAN_FILES is $(FIND_CHAN_FILES)
show-wire-files:
@echo WIRE_DIR is $(WIRE_DIR)
@echo WIRE_PATTERN is $(WIRE_PATTERN)
@echo WIRE_FILE is $(WIRE_FILE)
@echo TX_WIRE_DIR is $(TX_WIRE_DIR)
@echo TX_WIRE_PATTERN is $(TX_WIRE_PATTERN)
@echo TX_WIRE_FILE is $(TX_WIRE_FILE)
show-lods:
@echo LODS is $(LODS)
@echo LOD_EGG_FILES is $(LOD_EGG_FILES)
show-models:
@echo NURBS_MODEL_READ is $(NURBS_MODEL_READ)
@echo NURBS_MODEL_WRITE is $(NURBS_MODEL_WRITE)
@echo POLY_MODEL_READ is $(POLY_MODEL_READ)
@echo POLY_MODEL_WRITE is $(POLY_MODEL_WRITE)
@echo MODEL_FILES_READ is $(MODEL_FILES_READ)
@echo MODEL_FILES_WRITE is $(MODEL_FILES_WRITE)
@echo OPT_EGG_FILES is $(OPT_EGG_FILES)
@echo UNOPT_EGG_FILES_READ is $(UNOPT_EGG_FILES_READ)
@echo UNOPT_EGG_FILES_WRITE is $(UNOPT_EGG_FILES_WRITE)
@echo INSTALL_MODEL_FILES is $(INSTALL_MODEL_FILES)
@echo INSTALL_INST_FILES is $(INSTALL_INST_FILES)
@echo PAL_MODEL_FILES is $(PAL_MODEL_FILES)
@echo PT_FILES is $(PT_FILES)
@echo INSTALL_CHAN_FILES is $(INSTALL_CHAN_FILES)
@echo .txa file is $(TEXATTRIB_DIR)/$(PALETTE_NAME).txa

View File

@ -0,0 +1,71 @@
#### Makefile for binaries. Any fields commented out are optional.
#### Generated automatically by ppremake 0.20a from Sources.pp.
################################# DO NOT EDIT ###########################
#### Target's name:
TARGET = findlatest
# Standard .o file conversion information.
#### Lex files
LFILES =
LEX = flex
LFLAGS = -olex.yy.c
LEXTENSION = yy.cxx
# LSUBST =
#### Yacc files
YFILES =
YACC = bison
YFLAGS = -y -d
YEXTENSION = tab.cxx
# YSUBST =
#### C files
CFILES =
CFLAGS =
#### C++ files
C++FILES = findlatest.cxx
C++FLAGS =
#### Additional search directories for C/C++ header files:
IPATH = \
-I/usr/local/mozilla/dist/Linux2.2.10_x86_PTH_DBG.OBJ/include \
-I/usr/local/include/python1.6
#### Location to put .o files:
# ODIR =
#### Source file dependencies (unnecessary with clearmake)
# foo.c: foo.h
#### Other files and lib. Include $(ODIR) in any .o names.
# OFILES =
WHEN_NO_DEFER_LIBS = -ldtoolbase
WHEN_DEFER_LIBS = -ldtoolbase
LIBS =
SYSLIBS = -lnspr3
ifeq (WIN32_VC,$(PENV_COMPILER))
SYSLIBS +=
else
SYSLIBS +=
endif
#### Additional search directories for lib:
LPATH =
#### Other linker flags.
# LDFLAGS =
#### Pull in standard .o make variables
include $(DTOOL)/inc/Makefile.o.vars
#### The .o action is here.
include $(DTOOL)/inc/Makefile.o.rules
#### Pull in standard binary make variables.
include $(DTOOL)/inc/Makefile.bin.vars
#### The bin action is here.
include $(DTOOL)/inc/Makefile.bin.rules

View File

@ -0,0 +1,166 @@
#
# Makefile rules for compiling Multigen scene models into egg, and
# then into pfb's (or whatever). This uses rflt2egg (in $DWDTOOL/bin) to
# automatically resolve and convert referenced files.
#
include $(DTOOL)/inc/Makefile.inst-egg.vars
ifeq ($(RFLT2EGG),)
RFLT2EGG = rflt2egg
endif
ifeq ($(EGG_PALETTIZE),)
EGG_PALETTIZE = egg-palettize
endif
ifeq ($(EGG_COMBINE),)
EGG_COMBINE = egg-combine
endif
ifeq ($(EGG_TEXTURES),)
EGG_TEXTURES = egg-textures
endif
ifeq ($(PFICONV),)
PFICONV = pficonv -m
endif
ifeq ($(PFI_DIR),)
PFI_DIR = $(FLT_PFI_DIR)
endif
ifeq ($(INSTALL_DIR),)
INSTALL_DIR = $(INSTALL_ROOT)/models/$(SCENE_DIR)
endif
ifeq ($(EGG_NAME),)
EGG_NAME = $(SCENE)
endif
ifeq ($(BUILD_MODELS),)
BUILD_MODELS = $(EGG_NAME)
endif
ifeq ($(SCENE_DIR),)
SCENE_DIR = snarf
endif
# This helps out some of the generic option variables that are used for
# both chars and scenes.
CHAR_NAME = $(SCENE)
ifneq ($(PALETTE_NAME),)
# If the palette name is nonempty, make sure it doesn't contain slashes.
PALETTE_NAME := $(subst /,-,$(PALETTE_NAME))
endif
UNPAL_EGG_DIR = $(SCENE_DIR)
ifneq ($(PALETTE_NAME),)
PAL_EGG_DIR = $(MG_BUILD_DIR)/pal
else
PAL_EGG_DIR = $(UNPAL_EGG_DIR)
endif
# INSTALL_FROM_DIR is the name of the subdirectory from which the
# final egg files will be installed. If unspecified, it defaults to
# either PAL_EGG_DIR. This can be used to apply a last-minute
# operation on the egg file within the makefile.
ifeq ($(INSTALL_FROM_DIR),)
INSTALL_FROM_DIR = $(PAL_EGG_DIR)
endif
# BUILD_NAMES is the filename, without directory, of each of BUILD_MODELS.
# Often this will be the same, but it is allowed to specified a relative
# filename on each BUILD_MODEL.
BUILD_NAMES := $(notdir $(BUILD_MODELS))
TEST_EGG_FILES := $(patsubst %,rflt2egg-%.egg,$(BUILD_MODELS))
SHOW_RFLT2EGG_FILES := $(patsubst %,show-rflt2egg-%.egg,$(BUILD_MODELS))
UNPAL_EGG_FILES := $(patsubst %,$(UNPAL_EGG_DIR)/%.egg,$(BUILD_MODELS))
PAL_EGG_FILES := $(patsubst %,$(PAL_EGG_DIR)/%.egg,$(BUILD_NAMES))
INSTALL_INST_FILES := $(patsubst %,$(INSTALL_DIR)/%.$(INST),$(BUILD_NAMES))
.PHONY: pfb clean cleanall all_dirs check-palette
.PHONY: $(TEST_EGG_FILES) $(SHOW_RFLT2EGG_FILES)
pfb: all_dirs check-palette $(INSTALL_INST_FILES)
all_dirs: maps $(INSTALL_DIR)
rflt2egg: $(SHOW_RFLT2EGG_FILES)
ifneq ($(PALETTE_NAME),)
all_dirs: pal
endif
# This is a phony rule which invokes rflt2egg to freshen up an egg file from
# its .flt sources.
$(TEST_EGG_FILES) : rflt2egg-%.egg :
@$(RFLT2EGG) -F $(MG_SOURCE_ROOT) $(RFLT2EGG_OPTS) $(patsubst rflt2egg-%,$(UNPAL_EGG_DIR)/%,$@)
# This is another phony rule, just like the above except it doesn't squelch
# the rflt2egg command. Handy for debugging.
$(SHOW_RFLT2EGG_FILES) : show-rflt2egg-%.egg :
@echo ""
@echo $(patsubst show-rflt2egg-%,$(UNPAL_EGG_DIR)/%,$@)
$(RFLT2EGG) -vv -F $(MG_SOURCE_ROOT) $(RFLT2EGG_OPTS) $(patsubst show-rflt2egg-%,$(UNPAL_EGG_DIR)/%,$@)
# We need to have a command here so make won't optimize it out. Make doesn't
# know about the side-effect of $(TEST_EGG_FILES), above, on this target.
$(UNPAL_EGG_FILES) : $(UNPAL_EGG_DIR)/%.egg : rflt2egg-%.egg
@echo ""
#
# Palettizing.
#
ifneq ($(PALETTE_NAME),)
PT_FILES := $(patsubst %.egg,%.pt,$(UNPAL_EGG_FILES))
$(PT_FILES) : %.pt : %.egg
touch $@
$(PAL_EGG_FILES) : $(PT_FILES)
$(EGG_PALETTIZE) -t -de $(PAL_EGG_DIR) -dm $(INSTALL_ROOT)/maps $(PALETTIZE_OPTS) $(TEXATTRIB_DIR)/$(PALETTE_NAME).txa $(patsubst %.pt,$(MG_BUILD_DIR)/%.egg,$^)
endif
$(INSTALL_INST_FILES) : $(INSTALL_DIR)/%.$(INST) : $(INSTALL_FROM_DIR)/%.egg
$(INSTALL_EGG_ACTION)
clean:
# Not really much we can do here.
cleanall: clean
# Or here.
pal:
@test -d $(MG_BUILD_DIR)/pal || mkdir -p $(MG_BUILD_DIR)/pal
maps:
@test -d $(BUILD_DIR)/maps || mkdir -p $(BUILD_DIR)/maps
$(INSTALL_DIR) :
@test -d $@ || mkdir -p $@
ifneq ($(PALETTE_NAME),)
check-palette: $(TEXATTRIB_DIR)/$(PALETTE_NAME).pi
$(TEXATTRIB_DIR)/$(PALETTE_NAME).pi : $(TEXATTRIB_DIR)/$(PALETTE_NAME).txa
$(EGG_PALETTIZE) -t $(PALETTIZE_OPTS) $<
$(TEXATTRIB_DIR)/$(PALETTE_NAME).txa :
@echo $@
else
check-palette:
endif
show-models:
@echo UNPAL_EGG_DIR is $(UNPAL_EGG_DIR)
@echo UNPAL_EGG_FILES is $(UNPAL_EGG_FILES)
show-palette-name:
@echo palette_name is $(PALETTE_NAME)

View File

@ -0,0 +1,43 @@
#
# Makefile variables for converting egg files into some (likely binary)
# file format and installing them in the install directory.
#
# The default is to install them directly as egg files, without
# converting. Redefine the following variables to change this.
# This is the extension of the installed files.
ifeq ($(INST),)
INST = egg
endif
# This is the program to install them. It depends on the variables
# EGG2INST_SOURCE and EGG2INST_TARGET. We define default program lines
# for the three types of installable files we know--eggs, bams, and pfbs--
# but this may easily be extended by defining your own.
ifeq ($(EGG2INST),)
ifeq ($(INST),egg)
EGG2INST = cp $(EGG2INST_SOURCE) $(EGG2INST_TARGET)
endif
ifeq ($(INST),bam)
EGG2INST = egg2bam $(EGG2INST_SOURCE) -o $(EGG2INST_TARGET)
endif
ifeq ($(INST),pfb)
EGG2INST = egg2pfb $(EGG2INST_SOURCE) && mv $(basename $(EGG2INST_SOURCE)).pfb $(EGG2INST_TARGET)
endif
endif
# These are the variables that will be filled in with the files to
# read and produce, respectively. Don't redefine these.
EGG2INST_SOURCE = $<
EGG2INST_TARGET = $@.installing
# We do this two-step installation rule just to minimize the amount of
# time the installed file is half-complete. We first convert the egg
# file into a temporary filename in the install directory, and then
# rename it to its desired filename.
INSTALL_EGG_ACTION = \
$(EGG2INST) && mv $(EGG2INST_TARGET) $@

View File

@ -0,0 +1,65 @@
#
# Makefile rules for compiling SoftImage character models.
#
ifeq ($(SOFT2EGG),)
SOFT2EGG = soft2egg
endif
ifeq ($(SOFT2EGG_CLEAN),)
SOFT2EGG_CLEAN = soft2egg-clean
endif
ifeq ($(SCENE_PREFIX),)
SCENE_PREFIX = $(CHAR_NAME)-
endif
ifeq ($(DATABASE_DIR),)
DATABASE_DIR = $(SOURCE_ROOT)/$(DIR_NAME)
endif
ifeq ($(SOFT_SCENE_DIR),)
SOFT_SCENE_DIR = $(DATABASE_DIR)/SCENES
endif
ifeq ($(SOFT_MODEL_PATTERN),)
SOFT_MODEL_PATTERN = $(SCENE_PREFIX)$(MODEL_NAME).*.dsc
endif
ifeq ($(SOFT_ANIM_PATTERN),)
SOFT_ANIM_PATTERN = $(SCENE_PREFIX)$(ANIM).*.dsc
endif
# CHAN_DIR and WIRE_DIR are names inherited from Makefile.a2egg.rules.
# Makefile.char-egg.rules expects these to contain sensible values,
# so we feed them both the SOFT_SCENE_DIR directory.
CHAN_DIR = $(SOFT_SCENE_DIR)
WIRE_DIR = $(SOFT_SCENE_DIR)
# Similarly for WIRE_PATTERN and CHAN_PATTERN.
WIRE_PATTERN = $(SOFT_MODEL_PATTERN)
CHAN_PATTERN = $(SOFT_ANIM_PATTERN)
ifneq ($(TESS_LEVELS)$(QTESS_LEVELS),)
# If we are tesselating, we must force the nurbs model generation.
ifeq ($(NURBS_OPTS),)
NURBS_OPTS = -n
endif
endif
S2E_RULE = $(UNOPT)$(EGG_NAME)-$(MODEL).egg : $(WIRE_FILE) maps
S2E = $(SOFT2EGG_CLEAN) -M $@ -d $(DATABASE_DIR) -t maps
S2C_RULE = $(UNOPT)$(CHAN_FILE_PREFIX)$(ANIM)$(CHAN_FILE_SUFFIX).egg : $(FIND_CHAN_FILES)
S2C = $(SOFT2EGG) -a -A $@ -d $(DATABASE_DIR) -s $(notdir $<) $(S2C_OPTS)
SOFT_MODEL = $(notdir $(WIRE_FILE))
MAKE_POLY_MODEL = $(S2E) -s $(SOFT_MODEL) $(POLY_OPTS) $(S2E_OPTS)
MAKE_NURBS_MODEL = $(S2E) -s $(SOFT_MODEL) $(NURBS_OPTS) $(S2E_OPTS)
MAKE_TX_MODEL = a2egg -nsk -m $@ $(MAKE_TX_OPTS) $(TX_WIRE_FILE)
include $(DTOOL)/inc/Makefile.char-egg.rules

View File

@ -0,0 +1,211 @@
#
# Makefile rules for converting egg files which were originally hand-crafted
# into pfb's.
#
include $(DTOOL)/inc/Makefile.inst-egg.vars
ifeq ($(EGG_RESTRUCTURE),)
EGG_RESTRUCTURE = egg-restructure
endif
ifeq ($(EGG_PALETTIZE),)
EGG_PALETTIZE = egg-palettize
endif
ifeq ($(EGG_COMBINE),)
EGG_COMBINE = egg-combine
endif
ifeq ($(EGG_TEXTURES),)
EGG_TEXTURES = egg-textures
endif
ifeq ($(PFICONV),)
PFICONV = pficonv -m
endif
ifeq ($(INSTALL_DIR),)
INSTALL_DIR = $(INSTALL_ROOT)/models/$(SCENE_DIR)
endif
ifeq ($(EGG_NAME),)
EGG_NAME = $(SCENE)
endif
ifeq ($(BUILD_MODELS),)
BUILD_MODELS = $(EGG_NAME)
endif
ifeq ($(SCENE_DIR),)
SCENE_DIR = snarf
endif
ifeq ($(PFI_DIR),)
PFI_DIR = $(FLT_PFI_DIR)
endif
ifeq ($(SOURCE_DIR),)
SOURCE_DIR = $(EGG_SOURCE_ROOT)/$(SCENE_DIR)
endif
# This helps out some of the generic option variables that are used for
# both chars and scenes.
CHAR_NAME = $(SCENE)
# If we have RESTRUCTURE_OPTS set, then we must generate the model file into
# the unstructure directory, and restructure it into the current directory.
# Otherwise, we just generate it directly into the current directory.
ifneq ($(RESTRUCTURE_OPTS),)
INIT_EGG_DIR = unstructure
UNPAL_EGG_DIR = $(SCENE_DIR)
else
INIT_EGG_DIR = $(SCENE_DIR)
UNPAL_EGG_DIR = $(SCENE_DIR)
endif
ifneq ($(PALETTIZE_OPTS),)
PAL_EGG_DIR = pal
else
PAL_EGG_DIR = $(UNPAL_EGG_DIR)
endif
ifneq ($(MAKE_PFI),)
PFI_EGG_DIR = pfi
EGG2INST_OPTS = -t
else
PFI_EGG_DIR = $(PAL_EGG_DIR)
endif
# INSTALL_FROM_DIR is the name of the subdirectory from which the final
# egg files will be installed. If unspecified, it defaults to either
# PAL_EGG_DIR or PFI_EGG_DIR, depending on whether pfi's are built. This
# can be used to apply a last-minute operation on the egg file within the
# makefile.
ifeq ($(INSTALL_FROM_DIR),)
INSTALL_FROM_DIR = $(PFI_EGG_DIR)
endif
# BUILD_NAMES is the filename, without directory, of each of BUILD_MODELS.
# Often this will be the same, but it is allowed to specified a relative
# filename on each BUILD_MODEL.
BUILD_NAMES := $(notdir $(BUILD_MODELS))
INIT_EGG_FILES := $(patsubst %,$(INIT_EGG_DIR)/%.egg,$(BUILD_MODELS))
UNPAL_EGG_FILES := $(patsubst %,$(UNPAL_EGG_DIR)/%.egg,$(BUILD_MODELS))
PAL_EGG_FILES := $(patsubst %,$(PAL_EGG_DIR)/%.egg,$(BUILD_NAMES))
PFI_EGG_FILES := $(patsubst %,$(PFI_EGG_DIR)/%.egg,$(BUILD_NAMES))
INSTALL_INST_FILES := $(patsubst %,$(INSTALL_DIR)/%.$(INST),$(BUILD_NAMES))
ifneq ($(PALETTIZE_TOGETHER),)
# If we only have one file, don't attempt to palettize it together with
# itself. PALETTIZE_TOGETHER only makes sense if we have multiple files.
ifeq ($(words $(PAL_EGG_FILES)),1)
PALETTIZE_TOGETHER :=
endif
endif
.PHONY: egg pfb clean cleanall all_dirs
egg: all_dirs $(UNPAL_EGG_FILES)
pfb: egg $(INSTALL_INST_FILES)
all_dirs: maps $(SCENE_DIR) $(INSTALL_DIR)
ifneq ($(RESTRUCTURE_OPTS),)
all_dirs: unstructure
endif
ifneq ($(PALETTIZE_OPTS),)
all_dirs: pal
endif
ifneq ($(MAKE_PFI),)
all_dirs: pfi $(PFI_DIR)
endif
# This is the basic rule. If the including makefile doesn't specify anything
# else, we use this rule to build our egg file.
$(INIT_EGG_DIR)/%.egg : $(SOURCE_DIR)/%.egg
cp $< $@
#
# Restructuring.
#
ifneq ($(RESTRUCTURE_OPTS),)
$(UNPAL_EGG_FILES) : $(UNPAL_EGG_DIR)/%.egg : $(INIT_EGG_DIR)/%.egg
$(EGG_RESTRUCTURE) -o $@ $(RESTRUCTURE_OPTS) $<
endif
#
# Palettizing.
#
ifneq ($(PALETTIZE_OPTS),)
ifneq ($(PALETTIZE_TOGETHER),)
# If there are multiple files and the user so requested, palettize them all
# together.
$(UNPAL_EGG_DIR)/$(EGG_NAME)-combine.egg : $(UNPAL_EGG_FILES)
$(EGG_COMBINE) -o $@ $^
$(PAL_EGG_DIR)/$(EGG_NAME)-combine.egg : $(UNPAL_EGG_DIR)/$(EGG_NAME)-combine.egg
$(EGG_PALETTIZE) -o $@ $(PALETTIZE_OPTS) -p $(EGG_NAME)-palette. $<
$(PAL_EGG_FILES) : $(PAL_EGG_DIR)/$(EGG_NAME)-combine.egg
$(EGG_COMBINE) -x -p $(PAL_EGG_DIR)/ $<
else
# If there's only one file, or the user didn't request a group palettizing,
# palettize them separately.
ifeq ($(BUILD_MODELS),$(BUILD_NAMES))
# If none of the build models had directories, we can do it this way.
$(PAL_EGG_FILES) : $(PAL_EGG_DIR)/%.egg : $(UNPAL_EGG_DIR)/%.egg
$(EGG_PALETTIZE) -o $@ $(PALETTIZE_OPTS) -p $(patsubst $(PAL_EGG_DIR)/%.egg,%,$@)-palette. $<
else
# Otherwise, we have an error. Don't put a rule for the palettized files,
# so the make will stop.
endif
endif
endif
ifneq ($(MAKE_PFI),)
$(PFI_EGG_FILES) : $(PFI_EGG_DIR)/%.egg : $(PAL_EGG_DIR)/%.egg
$(EGG_TEXTURES) -o $@ -d $(PFI_DIR)/$(PFI_PREFIX) -e pfi -n -p "$(PFICONV) %o %n" $<
endif
$(INSTALL_INST_FILES) : $(INSTALL_DIR)/%.$(INST) : $(INSTALL_FROM_DIR)/%.egg
$(INSTALL_EGG_ACTION)
clean:
# Not really much we can do here.
cleanall: clean
# Or here.
unstructure:
mkdir unstructure
pal:
mkdir pal
pfi:
mkdir pfi
maps:
mkdir maps
ifneq ($(SCENE_DIR),.)
$(SCENE_DIR) :
mkdir -p $@
endif
$(INSTALL_DIR) :
mkdir -p $@
ifneq ($(PFI_DIR),$(INSTALL_DIR))
$(PFI_DIR) :
mkdir -p $@
endif

View File

@ -0,0 +1,36 @@
#
# Makefile rules for converting texture maps from characters to rgb format
# and/or reducing them.
#
ifeq ($(DEFAULT_SIZE),)
DEFAULT_SIZE = -2
endif
RESIZE = image-resize
DEF_RESIZE = $(RESIZE) $(DEFAULT_SIZE)
all:
maps/%.rgb:
$(DEF_RESIZE) $< $@
maps/%.rgba:
$(DEF_RESIZE) $< $@
ifneq ($(FULL_SIZE),)
$(patsubst %,maps/%,$(FULL_SIZE)) : % :
$(DEF_RESIZE) -x 100% $< $@
endif
ifneq ($(HALF_SIZE),)
$(patsubst %,maps/%,$(HALF_SIZE)) : % :
$(DEF_RESIZE) -x 50% $< $@
endif
ifneq ($(QUARTER_SIZE),)
$(patsubst %,maps/%,$(QUARTER_SIZE)) : % :
$(DEF_RESIZE) -x 25% $< $@
endif

View File

@ -0,0 +1,11 @@
#define INSTALL_HEADERS \
Makefile.a2egg-static.rules Makefile.a2egg.rules \
Makefile.char-egg.rules Makefile.findlatest Makefile.flt-egg.rules \
Makefile.inst-egg.vars Makefile.soft2egg.rules \
Makefile.source-egg.rules Makefile.textures.rules
#begin bin_target
#define TARGET findlatest
#define SOURCES findlatest.cxx
#define LOCAL_LIBS dtoolbase
#end bin_target

View File

@ -0,0 +1,171 @@
// Filename: findlatest.C
// Created by: drose (28Aug97)
//
////////////////////////////////////////////////////////////////////
#include <dtoolbase.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
static const int max_vnums = 10;
#ifndef True
static const int True = 1;
static const int False = 0;
#endif
// The VersionNumber class defines the sequence of integers that makes
// up a SoftImage file version number. One file's version is greater
// than another file's if the first integer from the left that differs
// is greater.
class VersionNumber {
public:
VersionNumber();
VersionNumber(const VersionNumber &copy);
VersionNumber &operator = (const VersionNumber &copy);
int operator < (const VersionNumber &copy);
void Extract(const char *filename);
void Output(ostream &out) const;
int num_vnums;
int vnums[max_vnums];
};
inline ostream &operator << (ostream &out, const VersionNumber &v) {
v.Output(out);
return out;
}
VersionNumber::
VersionNumber() {
num_vnums = 0;
}
VersionNumber::
VersionNumber(const VersionNumber &copy) {
(*this) = copy;
}
VersionNumber &VersionNumber::
operator = (const VersionNumber &copy) {
num_vnums = copy.num_vnums;
assert(num_vnums < max_vnums);
for (int i = 0; i < num_vnums; i++) {
vnums[i] = copy.vnums[i];
}
return *this;
}
int VersionNumber::
operator < (const VersionNumber &copy) {
for (int i = 0; i < num_vnums && i < copy.num_vnums; i++) {
if (vnums[i] < copy.vnums[i]) {
return True;
} else if (vnums[i] > copy.vnums[i]) {
return False;
}
}
return (num_vnums < copy.num_vnums);
}
// Extract the version number from a filename.
void VersionNumber::
Extract(const char *filename) {
const char *basename = strchr(filename, '/');
basename = (basename == NULL) ? filename : basename + 1;
// Now basename is the beginning of the file, sans directory.
// Find the extension.
const char *ext = strrchr(basename, '.');
if (ext == NULL) {
ext = basename+strlen(basename);
}
// Now walk back from the extension, until we find something that's
// not a number.
int temp_vnums[max_vnums];
int v = 0;
const char *d = ext-1;
while (v < max_vnums && d >= basename && isdigit(*d)) {
while (d >= basename && isdigit(*d)) {
d--;
}
temp_vnums[v++] = atoi(d+1);
if (*d=='-' || *d=='.') {
d--;
}
}
// temp_vnums now has our version numbers in right-to-left order.
// Reverse them back into vnums.
for (int i = 0; i < v; i++) {
vnums[i] = temp_vnums[v-1-i];
}
num_vnums = v;
}
void VersionNumber::
Output(ostream &out) const {
out << "(";
for (int i = 0; i < num_vnums; i++) {
out << " " << vnums[i];
}
out << " )";
}
void
usage() {
cerr <<
"Usage:\n\n"
" findlatest dir file1 file2 file3 ... fileN\n\n"
"Finds the filename with the greatest version number, and echoes dir/file.\n"
"This is intended to identify the most recent version of a file in a directory.\n"
"The files are assumed to be of the form basename[vvv].extension, where\n"
"basename and extension are any arbitrary string, and vvv is any string\n"
"of integers delimited by '.' or '-'.\n"
"\n";
}
int
main(int argc, char *argv[]) {
if (argc<2) {
usage();
exit(0);
}
if (argc<3) {
// No files.
exit(0);
}
VersionNumber max_version;
int max_i = 0;
VersionNumber v;
for (int i = 2; i < argc; i++) {
v.Extract(argv[i]);
if (max_version < v) {
max_version = v;
max_i = i;
}
}
if (max_i > 0) {
cout << argv[1] << '/' << argv[max_i] << "\n";
}
return (0);
}