From 4f13a5c9ea4994bd44ff91d3a6200113f863977b Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 17 Oct 2024 09:07:56 +0100 Subject: make: look for PDPmakefile As an extension have pdpmake look for the file 'PDPmakefile' before 'makefile' and 'Makefile'. This is similar to how GNU make first checks for 'GNUmakefile'. Adds 32-40 bytes. --- miscutils/make.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'miscutils/make.c') diff --git a/miscutils/make.c b/miscutils/make.c index 8d953f9fc..868cab5e2 100644 --- a/miscutils/make.c +++ b/miscutils/make.c @@ -3122,7 +3122,6 @@ int make_main(int argc UNUSED_PARAM, char **argv) #if ENABLE_FEATURE_MAKE_POSIX const char *prag; #endif - char def_make[] = "makefile"; int estat; bool found_target; FILE *ifd; @@ -3247,17 +3246,17 @@ int make_main(int argc UNUSED_PARAM, char **argv) free((void *)newpath); if (!makefiles) { // Look for a default Makefile + if (!posix && (ifd = fopen("PDPmakefile", "r")) != NULL) + makefile = "PDPmakefile"; + else if ((ifd = fopen("PDPmakefile" + 3, "r")) != NULL) + makefile = "PDPmakefile" + 3; #if !ENABLE_PLATFORM_MINGW32 - for (; def_make[0] >= 'M'; def_make[0] -= 0x20) { -#else - { + else if ((ifd = fopen("Makefile", "r")) != NULL) + makefile = "Makefile"; #endif - if ((ifd = fopen(def_make, "r")) != NULL) { - makefile = def_make; - goto read_makefile; - } - } - error("no makefile found"); + else + error("no makefile found"); + goto read_makefile; } while ((file = llist_pop(&makefiles))) { -- cgit v1.2.3-55-g6feb