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:
Landon Curt Noll committed 2025-06-29 14:24:31 -07:00
1 parent b3f3928867
commit 9ef2799ad1
2 files changed
+28 -9

No files matched your search

+25 -6
View File
@@ -41,9 +41,9 @@ include ../var.mk
# 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]*
# 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%%
@@ -286,12 +286,31 @@ genpath:
# 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:
@(echo 'ENTRIES= '; \
(echo ${ENTRIES} ${NEW_ENTRY}) | ${TR} ' ' '\012' | ${SORT} -d -u) | \
${FMT} | ${SED} -e '2,$$s/^/\t/' -e 's/$$/ \\/' -e '$$s/ \\//'
@if [[ -z "${NEW_ENTRY}" ]]; then echo "$@: ERROR: NEW_ENTRY is empty" 1>&2; exit 1; fi
@if [[ ! -d "${NEW_ENTRY}" ]]; then echo "$@: ERROR: not a directory: ${YEAR}/${NEW_ENTRY}" 1>&2; exit 2; fi
@(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/ \\//'
########################