improve new_entry rule in Makefile.year for bin/new-dir.sh
We fix/improve the new_entry rule in `template/Makefile.year` that is used by `bin/new-dir.sh`. Changed `bin/new-dir.sh` VERSION from "2.0.1 2025-05-18" to "2.0.2 2025-05-29". Tested/testing using potential final round submissions.
This commit is contained in:
1 parent
b3f3928867
commit
9ef2799ad1
2 files changed
+28
-9
No files matched your search
+3
-3
@@ -107,7 +107,7 @@ export LC_ALL="C"
|
|||||||
|
|
||||||
# set variables referenced in the usage message
|
# set variables referenced in the usage message
|
||||||
#
|
#
|
||||||
export VERSION="2.0.1 2025-05-18"
|
export VERSION="2.0.2 2025-05-29"
|
||||||
NAME=$(basename "$0")
|
NAME=$(basename "$0")
|
||||||
export NAME
|
export NAME
|
||||||
export V_FLAG=0
|
export V_FLAG=0
|
||||||
@@ -478,7 +478,7 @@ fi
|
|||||||
if [[ $V_FLAG -ge 3 ]]; then
|
if [[ $V_FLAG -ge 3 ]]; then
|
||||||
echo "$0: debug[3]: forming temporary Makefile: $TMP_MAKEFILE" 1>&2
|
echo "$0: debug[3]: forming temporary Makefile: $TMP_MAKEFILE" 1>&2
|
||||||
fi
|
fi
|
||||||
sed -n -e '1,/^# BEGIN - DO NOT REMOVE THIS LINE - make new_entry uses this line #/p' "$MAKE_FILE" > "$TMP_MAKEFILE"
|
sed -n -e '1,/^# 1st - DO NOT REMOVE THIS LINE - bin/new-dir.sh uses this line #/p' "$MAKE_FILE" > "$TMP_MAKEFILE"
|
||||||
make -C "$YEAR_DIR" new_entry NEW_ENTRY="$ENTRY_DIR" >> "$TMP_MAKEFILE"
|
make -C "$YEAR_DIR" new_entry NEW_ENTRY="$ENTRY_DIR" >> "$TMP_MAKEFILE"
|
||||||
status="$?"
|
status="$?"
|
||||||
if [[ $status -ne 0 ]]; then
|
if [[ $status -ne 0 ]]; then
|
||||||
@@ -486,7 +486,7 @@ if [[ $status -ne 0 ]]; then
|
|||||||
"error code: $status" 1>&2
|
"error code: $status" 1>&2
|
||||||
exit 15
|
exit 15
|
||||||
fi
|
fi
|
||||||
sed -n -e '/^# END - DO NOT REMOVE THIS LINE - make new_entry also uses this #/,$p' "$MAKE_FILE" >> "$TMP_MAKEFILE"
|
sed -n -e '/^# 2nd - DO NOT REMOVE THIS LINE - bin/new-dir.sh uses this line #/,$p' "$MAKE_FILE" >> "$TMP_MAKEFILE"
|
||||||
|
|
||||||
|
|
||||||
# Update Makefile if is changes and not -n
|
# Update Makefile if is changes and not -n
|
||||||
|
|||||||
+25
-6
@@ -41,9 +41,9 @@ include ../var.mk
|
|||||||
# IOCCC entries
|
# IOCCC entries
|
||||||
###############
|
###############
|
||||||
|
|
||||||
# BEGIN - DO NOT REMOVE THIS LINE - make new_entry uses this line #
|
# 1st - DO NOT REMOVE THIS LINE - bin/new-dir.sh uses this line #
|
||||||
ENTRIES= submit.[0-9]*
|
ENTRIES= submit.[0-9]*
|
||||||
# BEGIN - DO NOT REMOVE THIS LINE - make new_entry uses this line #
|
# 2nd - DO NOT REMOVE THIS LINE - bin/new-dir.sh uses this line #
|
||||||
|
|
||||||
YEAR= %%YEAR%%
|
YEAR= %%YEAR%%
|
||||||
|
|
||||||
@@ -286,12 +286,31 @@ genpath:
|
|||||||
# NOTE: 'Don't Panic' if you don't understand the stuff below
|
# NOTE: 'Don't Panic' if you don't understand the stuff below
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
# add ${NEW_ENTRY} to the list of ${ENTRIES} and output Makefile lines to set updated ${ENTRIES} value
|
# new_entry - add a new entry directory name to the ${ENTRIES} Makefile variable
|
||||||
|
#
|
||||||
|
# Add ${NEW_ENTRY} to the list of ${ENTRIES} and output Makefile lines to set updated
|
||||||
|
# ${ENTRIES} Makefile variable.
|
||||||
|
#
|
||||||
|
# If list of ${ENTRIES} is long, we format it into a multi-line value setting with required
|
||||||
|
# backslashes and indentation. Duplicate values are removed and the initial 'submit.[0-9]*' (used
|
||||||
|
# during judging) is removed. The words (directory names) in ${ENTRIES} are sorted in C dictionary order.
|
||||||
|
#
|
||||||
|
# This rule is used by the bin/new-dir.sh shell script via:
|
||||||
|
#
|
||||||
|
# make -C ${YEAR} new_entry NEW_ENTRY=curds
|
||||||
#
|
#
|
||||||
new_entry:
|
new_entry:
|
||||||
@(echo 'ENTRIES= '; \
|
@if [[ -z "${NEW_ENTRY}" ]]; then echo "$@: ERROR: NEW_ENTRY is empty" 1>&2; exit 1; fi
|
||||||
(echo ${ENTRIES} ${NEW_ENTRY}) | ${TR} ' ' '\012' | ${SORT} -d -u) | \
|
@if [[ ! -d "${NEW_ENTRY}" ]]; then echo "$@: ERROR: not a directory: ${YEAR}/${NEW_ENTRY}" 1>&2; exit 2; fi
|
||||||
${FMT} | ${SED} -e '2,$$s/^/\t/' -e 's/$$/ \\/' -e '$$s/ \\//'
|
@(echo -n 'ENTRIES= '; \
|
||||||
|
(for dir in ${ENTRIES} ${NEW_ENTRY}; do \
|
||||||
|
if [[ $$dir != 'submit.[0-9]*' ]]; then echo "$$dir"; fi; \
|
||||||
|
done | \
|
||||||
|
LANG=C ${SORT} -d -u; \
|
||||||
|
) \
|
||||||
|
) | \
|
||||||
|
${FMT} | \
|
||||||
|
${SED} -e '2,$$s/^/\t/' -e 's/$$/ \\/' -e '$$s/ \\//'
|
||||||
|
|
||||||
|
|
||||||
########################
|
########################
|
||||||
|
|||||||
Reference in new issue
Block a user