View | Details | Raw Unified | Return to bug 32759
Collapse All | Expand All

(-)usr.bin/make/parse.c (-35 / +4 lines)
Lines 1830-1836 Link Here
1830
    char          *fullname;	/* full pathname of file */
1830
    char          *fullname;	/* full pathname of file */
1831
    IFile         *oldFile;	/* state associated with current file */
1831
    IFile         *oldFile;	/* state associated with current file */
1832
    char          *cp;		/* current position in file spec */
1832
    char          *cp;		/* current position in file spec */
1833
    char	  *prefEnd;
1834
1833
1835
    /*
1834
    /*
1836
     * Skip over whitespace
1835
     * Skip over whitespace
Lines 1862-1903 Link Here
1862
1861
1863
    /*
1862
    /*
1864
     * Now we know the file's name, we attempt to find the durn thing.
1863
     * Now we know the file's name, we attempt to find the durn thing.
1865
     * A return of NULL indicates the file don't exist.
1864
     * Search for it first on the -I search path, then on the .PATH
1866
     *
1865
     * search path, if not found in a -I directory.
1867
     * Include files are first searched for relative to the including
1868
     * file's location. We don't want to cd there, of course, so we
1869
     * just tack on the old file's leading path components and call
1870
     * Dir_FindFile to see if we can locate the beast.
1871
     * XXX - this *does* search in the current directory, right?
1872
     */
1866
     */
1873
1867
    fullname = Dir_FindFile (file, parseIncPath);
1874
    prefEnd = strrchr (fname, '/');
1875
    if (prefEnd != (char *)NULL) {
1876
	char  	*newName;
1877
1878
	*prefEnd = '\0';
1879
	newName = str_concat (fname, file, STR_ADDSLASH);
1880
	fullname = Dir_FindFile (newName, parseIncPath);
1881
	if (fullname == (char *)NULL) {
1882
	    fullname = Dir_FindFile(newName, dirSearchPath);
1883
	}
1884
	free (newName);
1885
	*prefEnd = '/';
1886
    } else {
1887
	fullname = (char *)NULL;
1888
    }
1889
1890
    if (fullname == (char *)NULL) {
1868
    if (fullname == (char *)NULL) {
1891
	/*
1869
        fullname = Dir_FindFile(file, dirSearchPath);
1892
	 * System makefile or makefile wasn't found in same directory as
1893
	 * included makefile. Search for it first on the -I search path,
1894
	 * then on the .PATH search path, if not found in a -I directory.
1895
	 * XXX: Suffix specific?
1896
	 */
1897
	fullname = Dir_FindFile (file, parseIncPath);
1898
	if (fullname == (char *)NULL) {
1899
	    fullname = Dir_FindFile(file, dirSearchPath);
1900
	}
1901
    }
1870
    }
1902
1871
1903
    if (fullname == (char *)NULL) {
1872
    if (fullname == (char *)NULL) {

Return to bug 32759