147 lines
5.9 KiB
Plaintext
147 lines
5.9 KiB
Plaintext
#
|
|
# Startversion target - generate version number (and alpha number) in a
|
|
# standard fashion
|
|
|
|
# Input
|
|
# - TOOLROOT macro is set to point to tools to use for this build.
|
|
# - mkversionnum and showversionnum available in $(TOOLROOT). These
|
|
# are part of the buildtools ism
|
|
# - include $(ROOT)/usr/include/make/releasedefs at the same level you
|
|
# include this file. This provides the definition of the
|
|
# TREE_ID and RELEASE_NUM macros
|
|
# - The WORKAREA environment variable pointing to a writable directory.
|
|
# Typically, this is a ptools workarea containing one or more
|
|
# ISMs. The version number generated applies to all of these
|
|
# ISMs.
|
|
# - set the following macros as needed
|
|
# BUILDER - (to 1 if project build, to 2 if build group build)
|
|
# defaults to 0 (developer build).
|
|
# TREE_ID - to an integer 1-9 to distinguish parallel OS efforts
|
|
# targeted to new hardware.
|
|
# It will default to the value of TREE_ID found in
|
|
# $(ROOT)/usr/include/make/releasedefs.
|
|
# PATCH_RELEASE - if creating a patch release (will default to first eight
|
|
# digits of $(WORKAREA)/.version_number)
|
|
# PATCH_NUM - patch number (sequences patch releases)
|
|
# VNUM_OVERRIDE - a ten digit version number to be directly used.
|
|
# This option is provided as a hook and should rarely if ever be
|
|
# used.
|
|
|
|
# Output
|
|
# - $(WORKAREA)/.version_number - the ten digit version number
|
|
# - $(WORKAREA)/.alpha_number - the alpha number portion of the
|
|
# version number
|
|
|
|
# Algorithm
|
|
#
|
|
# If PATCH_NUM is set then a patch release version number is generated.
|
|
# Else if VNUM_OVERRIDE is set then it will be used as the version number.
|
|
# Else a regular version number is generated.
|
|
#
|
|
# Patch version number
|
|
#
|
|
# first eight digit are PATCH_RELEASE if it is set.
|
|
# Else first eight digits of $(WORKAREA)/.version_number.
|
|
# It is and error for both PATCH_RELEASE and
|
|
# $(WORKAREA)/.version_number to be unset.
|
|
#
|
|
# last two digits are 30 + (PATCH_NUM mod 70).
|
|
# first eight digits generated above are (potentially)
|
|
# modified by adding PATCH_NUM/70 (this should rarely happen).
|
|
#
|
|
# Regular version number
|
|
#
|
|
# first three digits are RELEASE_NUM.
|
|
#
|
|
# next five digits are the number of hours since
|
|
# January 1, 1993 and are generated by the mkversionnum
|
|
# command.
|
|
#
|
|
# next digit is BUILDER.
|
|
#
|
|
# last digit is TREE_ID.
|
|
#
|
|
# Alpha number
|
|
# is the fourth thru eighth digits from the version number
|
|
# generated by the above steps. These five digits are the alpha
|
|
# number portion of the version number and are the number of
|
|
# hours since Jan 1, 1993.
|
|
#
|
|
|
|
#ident "$Revision: 1.8 $"
|
|
|
|
VNUM=$(WORKAREA)/.version_number
|
|
ANUM=$(WORKAREA)/.alpha_number
|
|
MKVERSIONNUM=$(TOOLROOT)/usr/sbin/mkversionnum
|
|
SHOWVERSIONNUM=$(TOOLROOT)/usr/sbin/showversionnum
|
|
|
|
# The file where the .o file with the ident string lives.
|
|
# Build this into all files, by building with RLS_ID_OBJECT=${V_IDENTFILE}
|
|
# in the environment. The cc driver automatically passes this to ld
|
|
## if set, as the last item on the ld line. No problem for standalone
|
|
# because all standalone (coff) programs use ld rather than the driver.
|
|
# variable constructed so the 3.18 (late alpha) ld recognizes the file
|
|
# as "PIC-neutral", so it can be used with shared and -non_shared
|
|
# binaries. Written so both ident and what show a meaningful string on
|
|
# all resulting binaries.
|
|
# This one definitely uses the TOOLROOT compiler; do not use $(CCF)
|
|
# because this may be included in Makefiles that do not define it.
|
|
V_IDENTFILE=${WORKAREA}/.identfile.o
|
|
V_IDENTFILE_64=${WORKAREA}/.ident_64.o
|
|
V_IDENTFILE_N32=${WORKAREA}/.ident_n32.o
|
|
|
|
# want this for the basic system release number for V_IDENTFILE
|
|
sinclude $(ROOT)/usr/include/make/releasedefs
|
|
|
|
startversion:
|
|
@if [ "$(WORKAREA)" = "" ]; then \
|
|
echo "You must set the WORKAREA environment variable"; \
|
|
exit 1; \
|
|
fi
|
|
@if [ "$(PATCH_NUM)" ]; then \
|
|
if [ "$(PATCH_RELEASE)" ]; then \
|
|
newvnum=`$(MKVERSIONNUM) -P "$(PATCH_RELEASE)" \
|
|
-p "$(PATCH_NUM)"` ; \
|
|
else \
|
|
patrel=`cat $(VNUM)`; \
|
|
newvnum=`$(MKVERSIONNUM) -P "$$patrel" -p "$(PATCH_NUM)"`;\
|
|
fi; \
|
|
else \
|
|
newvnum=`$(MKVERSIONNUM) -r "$(RELEASE_NUM)" -b "$(BUILDER)" \
|
|
-t "$(TREE_ID)" -f "$(VNUM_OVERRIDE)"` ; \
|
|
fi; \
|
|
echo "$$newvnum" > $(VNUM); \
|
|
echo "$$newvnum" | sed -e "s/...\(.....\)../\1/" > $(ANUM); \
|
|
$(SHOWVERSIONNUM) $$newvnum
|
|
#
|
|
#
|
|
@rm -f ${V_IDENTFILE}*
|
|
@echo 'const char __Release_ID[] = "@(#)\$$'Header: IRIX ${RELEASE}:`cat ${VNUM}` built `date +%D` at `hostname`:$$ROOT $$'";' > ${V_IDENTFILE}.c
|
|
@${TOOLROOT}/usr/bin/cc -mips1 -c ${V_IDENTFILE}.c -o ${V_IDENTFILE}
|
|
@echo Revision information that will go into all binaries is:
|
|
@ident ${V_IDENTFILE} 2>&1 | sed '/:$$/d'
|
|
@if [ "$$RLS_ID_OBJECT" != ${V_IDENTFILE} ]; then \
|
|
echo Warning: You do not have \$$RLS_ID_OBJECT set to ${V_IDENTFILE} in your environment ;\
|
|
echo If you do not do so, you will not get the o32bit ident string in the build;\
|
|
fi
|
|
#
|
|
#
|
|
@rm -f ${V_IDENTFILE_64}*
|
|
@echo 'const char __Release_ID[] = "@(#)$$'Header: IRIX ${RELEASE}:`cat ${VNUM}` built `date +%D` at `hostname`:$$ROOT $$'";' > ${V_IDENTFILE_64}.c
|
|
@echo 'static const char *p = __Release_ID;' >> ${V_IDENTFILE_64}.c
|
|
@${TOOLROOT}/usr/bin/cc -64 -mips3 -cckr -c ${V_IDENTFILE_64}.c -o ${V_IDENTFILE_64}
|
|
@if [ "$$RLS_ID_OBJECT64" != ${V_IDENTFILE_64} ]; then \
|
|
echo Warning: You do not have \$$RLS_ID_OBJECT64 set to ${V_IDENTFILE_64} in your environment ;\
|
|
echo If you do not do so, you will not get the 64bit ident string in the build;\
|
|
fi
|
|
#
|
|
#
|
|
@rm -f ${V_IDENTFILE_N32}*
|
|
@echo 'const char __Release_ID[] = "@(#)$$'Header: IRIX ${RELEASE}:`cat ${VNUM}` built `date +%D` at `hostname`:$$ROOT $$'";' > ${V_IDENTFILE_N32}.c
|
|
@echo 'static const char *p = __Release_ID;' >> ${V_IDENTFILE_N32}.c
|
|
@${TOOLROOT}/usr/bin/cc -n32 -mips3 -cckr -c ${V_IDENTFILE_N32}.c -o ${V_IDENTFILE_N32}
|
|
@if [ "$$RLS_ID_OBJECTN32" != ${V_IDENTFILE_N32} ]; then \
|
|
echo Warning: You do not have \$$RLS_ID_OBJECTN32 set to ${V_IDENTFILE_N32} in your environment ;\
|
|
echo If you do not do so, you will not get the n32bit ident string in the build;\
|
|
fi
|