make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU Make 3.81 + MKS incorrectly determining that files are up to date


From: Joshua Maurice
Subject: GNU Make 3.81 + MKS incorrectly determining that files are up to date
Date: Wed, 20 May 2009 15:22:06 -0700

I have greatly pared down this to a simple test which has make
incorrectly concluding a file is up to date when it should be building
it.

I'm using, as far as I can tell, MKS version 1.0.0.

$ gnumake --v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for Windows32
$

This is on windows XP service pack 3. Hard drive file system is NTFS.

This is a trimmed example from a build system I want to get into
production. However, I've noticed a quirk when running make right
after another make. I've attached my testing scripts which show that
separating make runs with sleeps produces the correct output, but
running without the sleeps can produce correct output and can produce
incorrect output.

To do the tests, set the env variable SRC_ROOT to point to the dir
containing the makefile. Create 4 files in the dir, jar_1_java_file_1,
jar_1_java_file_2, jar_2_java_file_1, and jar_2_java_file_2. Then
simply run ./bar.sh. It will first make an exemplar.txt file of the
output of the make runs with sleeps in between. Then it will start
running a loop without sleeps in between diffing the output, stopping
the loop when the output changes.

The output I expect is the output of exemplar.txt, which is posted
here. Also posted is the output in testrun.txt for a failure.

I'm sorry if this issue has already been posted and/or resolved. I
have been searching for this and other Make issues (mostly resolved
except for this) on these boards and elsewhere with google for the
last week now. (I still want a way to say a command makes all the
listed targets of the rule in a single go besides pattern rules.)


#### exemplar.txt
rm -f C:/makebug/some_jar_1
rm -f C:/makebug/some_jar_1.repo
rm -f C:/makebug/some_jar_2
rm -f C:/makebug/jar_1_class_file_1
rm -f C:/makebug/jar_1_class_file_2
rm -f C:/makebug/jar_2_class_file_1
rm -f C:/makebug/jar_2_class_file_2
x 0
touch C:/makebug/jar_1_class_file_1
x 0
touch C:/makebug/some_jar_1
touch C:/makebug/some_jar_1.repo
touch C:/makebug/jar_2_class_file_1
touch C:/makebug/jar_2_class_file_2
touch C:/makebug/some_jar_2
x 0
touch C:/makebug/jar_1_class_file_2
touch C:/makebug/some_jar_1
x 0
touch C:/makebug/jar_2_class_file_1
touch C:/makebug/jar_2_class_file_2
touch C:/makebug/some_jar_2
x 0
####
#### testrun.txt
rm -f C:/makebug/some_jar_1
rm -f C:/makebug/some_jar_1.repo
rm -f C:/makebug/some_jar_2
rm -f C:/makebug/jar_1_class_file_1
rm -f C:/makebug/jar_1_class_file_2
rm -f C:/makebug/jar_2_class_file_1
rm -f C:/makebug/jar_2_class_file_2
x 0
touch C:/makebug/jar_1_class_file_1
x 0
touch C:/makebug/some_jar_1
touch C:/makebug/some_jar_1.repo
touch C:/makebug/jar_2_class_file_1
touch C:/makebug/jar_2_class_file_2
touch C:/makebug/some_jar_2
x 0
touch C:/makebug/jar_1_class_file_2
x 0
gnumake: `C:/makebug/some_jar_2' is up to date.
x 0
####
#### makefile
all :
.PHONY : all


clean :
        rm -f $(SRC_ROOT)/some_jar_1
        rm -f $(SRC_ROOT)/some_jar_1.repo
        rm -f $(SRC_ROOT)/some_jar_2
        rm -f $(SRC_ROOT)/jar_1_class_file_1
        rm -f $(SRC_ROOT)/jar_1_class_file_2
        rm -f $(SRC_ROOT)/jar_2_class_file_1
        rm -f $(SRC_ROOT)/jar_2_class_file_2
.PHONY : clean


ifndef BUILD_JAR_2_ONLY
   # artifact 1
  all : $(SRC_ROOT)/some_jar_1
  $(SRC_ROOT)/some_jar_1 : $(SRC_ROOT)/jar_1_class_file_1
$(SRC_ROOT)/jar_1_class_file_2 ; touch $@
  $(SRC_ROOT)/jar_1_class_file_1 : $(SRC_ROOT)/jar_1_java_file_1 ; touch $@
  $(SRC_ROOT)/jar_1_class_file_2 : $(SRC_ROOT)/jar_1_java_file_2 ; touch $@
endif


 # artifact 2
all : $(SRC_ROOT)/some_jar_2
$(SRC_ROOT)/some_jar_2 : $(SRC_ROOT)/jar_2_class_file_1
$(SRC_ROOT)/jar_2_class_file_2 ; touch $@
$(SRC_ROOT)/jar_2_class_file_1 : $(SRC_ROOT)/jar_2_java_file_1
$(SRC_ROOT)/some_jar_1 ; touch $@
$(SRC_ROOT)/jar_2_class_file_2 : $(SRC_ROOT)/jar_2_java_file_2
$(SRC_ROOT)/some_jar_1 ; touch $@


 # repository
 # instead of touch $@, the rule would be cp, which carries its own
problems of timestamp inaccuracies
 # however, the problem is replicable with the current command touch
 # cp $(SRC_ROOT)/repo/$* $@
$(SRC_ROOT)/% :
        touch $@
        touch address@hidden
####
#### foo.sh
#! /bin/sh

cd ${SRC_ROOT}

gnumake clean
echo x $?

if test "x" = "x$1"; then :; else sleep 3; fi

gnumake ${SRC_ROOT}/jar_1_class_file_1
echo x $?

if test "x" = "x$1"; then :; else sleep 3; fi

gnumake ${SRC_ROOT}/some_jar_2 BUILD_JAR_2_ONLY=foo
echo x $?

if test "x" = "x$1"; then :; else sleep 3; fi

gnumake ${SRC_ROOT}/some_jar_1
echo x $?

if test "x" = "x$1"; then :; else sleep 3; fi

gnumake ${SRC_ROOT}/some_jar_2 BUILD_JAR_2_ONLY=foo
echo x $?
####
#### bar.sh
#! /bin/sh

cd ${SRC_ROOT}

./foo.sh 1 | tee exemplar.txt 2>&1
echo ----
while ./foo.sh | tee testrun.txt 2>&1 && diff exemplar.txt testrun.txt; do
  echo ----
done
####




reply via email to

[Prev in Thread] Current Thread [Next in Thread]