This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin GNU make using MAKE_MODE=win VPATH/vpath issues


I have searched the mail archives and FAQ but have only found remotely
similar issues to my problem.
http://www.cygwin.com/cygwin/2002-03/msg01240.html The similar thread seems
to be unresolved.

Cygwin Version = 1.5.7-1
GNU make = 3.80

When running make with MAKE_MODE=win or make --win32 the conversion of DOS
to POSIX paths in the VPATH variable and vpath directive seems to truncate
when given a large set of paths.  I have not had the chance to dig into the
vpath code, but I believe that when a conversion to POSIX path is completed
the complete path is treated as one unit.  This means that given a set of
paths used in VPATH/vpath the first DOS path is converted to POSIX form and
the rest of the path up to character length N is left as is. N seems to be
256 characters - 1 path. I am using space separated paths as the semi-colon
separators cause VPATH/vpath to be empty(GNU make manual states that for
MS-DOS/MS-WIN semi-colon is valid).

Example:
    vpath %.c C:\dos\path1 C:\dos\path2 ... C:\dos\path99
    If make -p is run we see
	vpath %c /cygdrive/c/dos/path1;C:\dos\path2;C\dos\path3....
    If the original set of paths combined is longer than N(N=256?) then the
path gets truncated.

    A simple workaround is to give multiple vpath directives as in:
	vpath %c C:\dos\path1
	vpath %c C:\dos\path2
	vpath %c C:\dos\path3
	...
    This method is inconsitant with my previous make/cygwin environment, and
I wish to avoid it.

The fact that only one path gets converted does not seem to confuse the make
internals, however the truncation definitely
causes issues. The fact that you can use multiple calls to vpath seems to
point to conversion after the first path entry.

Below is a test case and directory listing I used.  I ran the following to
obtain the results:
	make -r -p TEST_CASE=N &> tcN.txt (where N is testcase number)

(Start of Directory Listing)
drwxr-xr-x+   3 kcieplak mkgroup-     4096 Feb  9 14:29
ThisIsAReallyLongDirectoryNameToOverFlowABuffer
drwxr-xr-x+   3 kcieplak mkgroup-        0 Feb  9 14:05 dirlevel1
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 15:23 dirlist.txt
-rw-rw-rw-    1 kcieplak mkgroup-        0 Feb  9 15:01 level1.o
-rw-rw-rw-    1 kcieplak mkgroup-        0 Feb  9 15:01 level2.o
-rw-rw-rw-    1 kcieplak mkgroup-        0 Feb  9 15:01 level3.o
-rw-rw-rw-    1 kcieplak mkgroup-        0 Feb  9 15:01 longPath1.o
-rw-rw-rw-    1 kcieplak mkgroup-        0 Feb  9 15:01 longPath2.o
-rwxr-xr-x    1 kcieplak mkgroup-     2645 Feb  9 15:01 makefile
-rwxr-xr-x    1 kcieplak mkgroup-       18 Feb  9 15:03 results.txt
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 13:46 root.c
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 13:47 root.h
-rw-rw-rw-    1 kcieplak mkgroup-        0 Feb  9 15:01 root.o
-rw-r--r--    1 kcieplak mkgroup-    13780 Feb  9 14:59 tc1.txt
-rw-r--r--    1 kcieplak mkgroup-    11179 Feb  9 14:59 tc2.txt
-rw-r--r--    1 kcieplak mkgroup-    13745 Feb  9 14:59 tc3.txt
-rw-r--r--    1 kcieplak mkgroup-    15863 Feb  9 14:59 tc4.txt
-rw-r--r--    1 kcieplak mkgroup-    18296 Feb  9 15:01 tc5.txt

./ThisIsAReallyLongDirectoryNameToOverFlowABuffer:
total 8
drwxr-xr-x+   2 kcieplak mkgroup-        0 Feb  9 14:23
ThisIsTheSecondReallyLongDirectoryNameToOverFlowABuffer
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 14:23 longPath1.c
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 14:23 longPath1.h
-rw-r--r--    1 kcieplak mkgroup-     7822 Feb  9 14:29 out.txt

./ThisIsAReallyLongDirectoryNameToOverFlowABuffer/ThisIsTheSecondReallyLongD
irectoryNameToOverFlowABuffer:
total 0
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 14:23 longPath2.c
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 14:23 longPath2.h

./dirlevel1:
total 0
drwxr-xr-x+   3 kcieplak mkgroup-        0 Feb  9 14:10 dirlevel2
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 13:46 level1.c
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 13:46 levle1.h

./dirlevel1/dirlevel2:
total 0
drwxr-xr-x+   2 kcieplak mkgroup-        0 Feb  9 14:10 dirlevel3
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 13:46 level2.c
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 13:46 level2.h

./dirlevel1/dirlevel2/dirlevel3:
total 0
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 14:10 level3.c
-rw-r--r--    1 kcieplak mkgroup-        0 Feb  9 14:10 level3.h
(End of Directory Listing)

(Start of makefile)
#Define all directory paths using DOS style notation
ROOT_DIR :=C:\vpath_test
LEVEL1_DIR := $(ROOT_DIR)\dirlevel1
LEVEL2_DIR := $(LEVEL1_DIR)\dirlevel2
LEVEL3_DIR := $(LEVEL2_DIR)\dirlevel3
LONG_PATH_NAME1 :=
$(ROOT_DIR)\ThisIsAReallyLongDirectoryNameToOverFlowABuffer
LONG_PATH_NAME2 :=
$(LONG_PATH_NAME1)\ThisIsTheSecondReallyLongDirectoryNameToOverFlowABuffer

.PHONY: clean

#default test case
TEST_CASE := 1

############################################################################
####
#  Here are combinations of VPATH/vpath that give different results when
using
#  make with DOS paths running with MAKE_MODE=win 
############################################################################
####

####  Case 1 ####
#  Working Test Case all tarets build
ifeq ($(TEST_CASE), 1)
    OBJS := root.o level1.o level2.o level3.o
    vpath %.c $(LEVEL1_DIR) $(LEVEL2_DIR) $(LEVEL3_DIR)
    VPATH := $(LEVEL1_DIR) $(LEVEL2_DIR) $(LEVEL3_DIR)
endif 

####  Case 2 ####
#   Failure to build any level1.o
ifeq ($(TEST_CASE), 2)
    OBJS := root.o level1.o level2.o level3.o longPath1.o longPath2.o
    vpath %.c
$(LEVEL1_DIR);$(LEVEL2_DIR);$(LEVEL3_DIR);$(LONG_PATH_NAME1);$(LONG_PATH_NAM
E2)
    VPATH :=
$(LEVEL1_DIR);$(LEVEL2_DIR);$(LEVEL3_DIR);$(LONG_PATH_NAME1);$(LONG_PATH_NAM
E2)
endif

####  Case 3 ####
#   Failure to build level3.o
ifeq ($(TEST_CASE), 3)
    OBJS := root.o level1.o level2.o level3.o longPath1.o longPath2.o
    vpath %.c $(LONG_PATH_NAME1) $(LONG_PATH_NAME2) $(LEVEL1_DIR)
$(LEVEL2_DIR) $(LEVEL3_DIR)
    VPATH := $(LONG_PATH_NAME1) $(LONG_PATH_NAME2) $(LEVEL1_DIR)
$(LEVEL2_DIR) $(LEVEL3_DIR)
endif

####  Case 4 ####
#   Failure to build longPath2.o
ifeq ($(TEST_CASE), 4)
    OBJS := root.o level1.o level2.o level3.o longPath1.o longPath2.o
    vpath %.c $(LEVEL1_DIR) $(LEVEL2_DIR) $(LEVEL3_DIR) $(LONG_PATH_NAME1)
$(LONG_PATH_NAME2)
    VPATH := $(LEVEL1_DIR) $(LEVEL2_DIR) $(LEVEL3_DIR) $(LONG_PATH_NAME1)
$(LONG_PATH_NAME2)
endif

####  Case 5 ####
#   Workaround for VPATH/vpath issues
ifeq ($(TEST_CASE), 5)
    OBJS := root.o level1.o level2.o level3.o longPath1.o longPath2.o
    vpath %.c $(LEVEL1_DIR)
    vpath %.c $(LEVEL2_DIR)
    vpath %.c $(LEVEL3_DIR)
    vpath %.c $(LONG_PATH_NAME1)
    vpath %.c $(LONG_PATH_NAME2)
    VPATH := $(LEVEL1_DIR) $(LEVEL2_DIR) $(LEVEL3_DIR) $(LONG_PATH_NAME1)
$(LONG_PATH_NAME2)
endif

############################################################################
####
all: $(OBJS)

%.o: %.c
	@echo  Fake Compile
	@echo LEVEL1=$(LEVEL1_DIR)
	@echo LEVEL2=$(LEVEL2_DIR)
	touch "$@"
clean:
	rm -f *.o
(End of makefile)

Kristopher Cieplak


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]