From de7ba83559fa3c6d60c8941a5a894cf1b34cbbc4 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 8 Nov 2023 09:47:20 -0800 Subject: [PATCH 1/2] Fixes to 1992/ant The Makefile has had a new rule added and another fixed as 'am' does not support certain features that the Makefile uses. Added #include as the author stated that for some systems it might be necessary (like DOS with Turbo C assuming anyone here uses that). Typo fixes including references to files that do not exist (am.c -> ant.c and so on). Typo/format check README.md and ant.README. --- 1992/ant/Makefile | 28 ++++++++++++++++++---------- 1992/ant/README.md | 15 ++++++++------- 1992/ant/ant.README | 16 ++++++++-------- 1992/ant/ant.c | 1 + 1992/ant/ant.test.mk | 2 +- thanks-for-fixes.md | 16 ++++++++++++++++ 6 files changed, 52 insertions(+), 26 deletions(-) diff --git a/1992/ant/Makefile b/1992/ant/Makefile index 860c6efe1..af364bd51 100644 --- a/1992/ant/Makefile +++ b/1992/ant/Makefile @@ -113,7 +113,7 @@ PROG= ${ENTRY} # OBJ= ${PROG}.o DATA= -TARGET= ${PROG} am +TARGET= ${PROG} # ALT_OBJ= ALT_TARGET= @@ -129,15 +129,18 @@ all: data ${TARGET} .PHONY: all alt data everything diff_orig_prog diff_prog_orig \ diff_alt_prog diff_prog_alt diff_orig_alt diff_alt_orig \ clean clobber install love haste waste maker easter_egg \ - sandwich supernova deep_magic magic charon pluto + sandwich supernova deep_magic magic charon pluto \ supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} -am: ${PROG} - ${RM} -f $@ - ${LN} $< $@ +am: ant + rm -f am + ln ant am + cp am am.safe + cp am.safe am + rm -f am.safe # alternative executable # @@ -215,11 +218,16 @@ clobber: clean echo 'ate sandwich'; \ fi -am_clobber: clean am - ${RM} -f am.safe - ${CP} am am.safe - ${CP} am.safe am - ${RM} -f am.safe +am_clean: + rm -f ant.o am.o + @-if [ -f indent.c ]; then \ + echo ${RM} -f indent.c; \ + ${RM} -f indent.c; \ + fi + + +am_clobber: am_clean + rm -f am.safe install: @echo "Dr. Spock says that is not logical!" diff --git a/1992/ant/README.md b/1992/ant/README.md index eac1d8764..ade2667ad 100644 --- a/1992/ant/README.md +++ b/1992/ant/README.md @@ -8,7 +8,7 @@ make all ## To use: ```sh -./am Makefile +./ant Makefile ``` where `Makefile` is a Makefile to use. @@ -16,16 +16,17 @@ where `Makefile` is a Makefile to use. ### Try: +First build the tool itself with our Makefile: + ```sh -./ant ant.test.mk +./ant Makefile am ``` -We also suggest that you try: +Now use `am` to do some things: ```sh -make am ./am Makefile am_clobber # clobber everything except am -./am Makefile all +./am ant.test.mk # run the test Makefile with am ``` @@ -34,8 +35,8 @@ make am Like much of POSIX, obfuscation has its place. Your task is to figure out where. -This entry comes complete with a Posix-like command description. -Interested POSIX balloters should lobby the IEEE for an obfuscated\ +This entry comes complete with a POSIX-like command description. +Interested POSIX balloters should lobby the IEEE for an obfuscated P1003 subcommittee. diff --git a/1992/ant/ant.README b/1992/ant/ant.README index c69dc9118..e2b82a11f 100644 --- a/1992/ant/ant.README +++ b/1992/ant/ant.README @@ -35,7 +35,7 @@ None. OPERANDS -makefile This required argument, is a pathname of a description +makefile This required argument is a pathname of a description file, which is also referred to as the "makfile". A pathname of "-", shall *NOT* denote the standard input. @@ -123,7 +123,7 @@ MAKEFILE EXECUTION Command lines shall be processed one at a time by writing the command line to standard output, unless prefixed with an at-sign (@), and executing the command(s) in the line. Commands shall be executed by -passing the command line to the command interpreter via the system() +passing the command line to the command interpreter via the system(3) function. The environment for the command being executed shall contain all of the @@ -168,7 +168,7 @@ rules for the same target are ignored. There is *no* support for adding prerequisites to a target's prerequisite list once a target rule is defined. -There are no special targets or inference rule support. +There are no special targets and no inference rule support. MACROS @@ -191,7 +191,7 @@ the definition of environment variables, excluding parentheses, ( and ), which are used for delimiters. Macros can appear anywhere in the makefile, except within other macro -references (ie. no nesting). Macros in target and command lines shall +references (i.e. no nesting). Macros in target and command lines shall be evaluated when the line is read. Macros in macro definition lines shall be evaluated *IMMEDIATELY*. A macro that has not been defined shall evaluate to a null string without causing any error condition. @@ -233,7 +233,7 @@ tested on For all machines, the compile command line should be - cc -O -o am am.c + cc -O -o ant ant.c The value RULES represents the number of slots available to record target rules, dependencies, and commands. The default value chosen @@ -261,9 +261,9 @@ REFERENCES FILES -howe.c Obfuscated source -howe.README Manual for AM -howe.test.mk Test makefile +ant.c Obfuscated source +ant.README Manual for AM +ant.test.mk Test makefile BUGS diff --git a/1992/ant/ant.c b/1992/ant/ant.c index fb34068d6..1afe9a43a 100644 --- a/1992/ant/ant.c +++ b/1992/ant/ant.c @@ -8,6 +8,7 @@ #include #include #include +#include #ifndef RULES #define RULES 500 diff --git a/1992/ant/ant.test.mk b/1992/ant/ant.test.mk index 1634d4bef..6004c4fae 100644 --- a/1992/ant/ant.test.mk +++ b/1992/ant/ant.test.mk @@ -180,7 +180,7 @@ error.1: # Target where dependency does not exist. error.2: unknown -# Receipe command causes error. +# Recipe command causes error. error.3: t1 fail t2 fail: ls -l unknown diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 732c12bfa..a396ef871 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1387,6 +1387,22 @@ Thus Cody's fixed applies to the original entry. The problems were that function returning without a value. The function was changed to return void. +## [1992/ant](1992/ant/ant.c) ([README.md](1992/ant/README.md])) + +Cody fixed the Makefile so that the program will actually work with it (or at +least the rule to clobber files and link `am` to `ant`). The issue was that the +variables in the Makefile could not be evaluated in the same way as it's not as +feature-rich as other implementations of `make`. Thus the use of `${RM}` and +`${CP}` were in the respective rules changed to `rm` and `cp`, for two examples. +A new rule had to be added as well. The variable situation might be because they +are obtained from the root variable Makefile `var.mk` via `include` which the +program might not support (this has not been tested, however) and also because +it appears that the syntax for this program is to use `$()` rather than `${}`. + +The author stated that in some systems like DOS with Turbo C, it might be +necessary to include `time.h` so Cody did this as well. + + ## [1992/buzzard.1](1992/buzzard.1/buzzard.1.c) ([README.md](1992/buzzard.1/README.md)) Cody added a check for the right number of args, exiting 1 if not enough (2) From 36a50a1fc2ab0e37e50530bb457854a6644476fe Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 8 Nov 2023 09:58:30 -0800 Subject: [PATCH 2/2] Minor update to thanks file to do with 1992/ant --- thanks-for-fixes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index a396ef871..7ca8f4b1e 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1399,6 +1399,9 @@ are obtained from the root variable Makefile `var.mk` via `include` which the program might not support (this has not been tested, however) and also because it appears that the syntax for this program is to use `$()` rather than `${}`. +Cody also fixed another problem, unrelated, in the Makefile with the `.PHONY` +rule where a line was not ended with a `\` but should have been. + The author stated that in some systems like DOS with Turbo C, it might be necessary to include `time.h` so Cody did this as well.