/* foo/bar.h */
#pragma message ("Hello from " __FILE__)
This works in Linux:
Open Watcom Make Version 2.0 beta Feb 16 2021 14:12:57 (64-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wcl386 -I../foo -fo=main.obj -c -bt=nt main.c
Open Watcom C/C++ x86 32-bit Compile and Link Utility
Version 2.0 beta Feb 16 2021 14:25:27 (64-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wcc386 main.c -I../foo -fo=main.obj -bt=nt
Open Watcom C x86 32-bit Optimizing Compiler
Version 2.0 beta Feb 16 2021 14:16:34 (64-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
Hello from ../foo/bar.h
main.c: 4 lines, included 52, 0 warnings, 0 errors
Code size: 13
But the Windows version of wcl386 does not understand the forward slash passed to -I:
Open Watcom Make Version 2.0 beta Feb 16 2021 14:12:59 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wcl386 -I../foo -fo=main.obj -c -bt=nt main.c
Open Watcom C/C++ x86 32-bit Compile and Link Utility
Version 2.0 beta Feb 16 2021 14:25:28 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wcc386 main.c -I../foo -fo=main.obj -bt=nt
Open Watcom C x86 32-bit Optimizing Compiler
Version 2.0 beta Feb 16 2021 14:16:42 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
main.c(2): Error! E1055: Unable to open 'bar.h'
main.c: 4 lines, included 49, 0 warnings, 1 errors
Error: Compiler returned a bad status compiling "main.c"
Error(F38): (main.obj) does not exist and cannot be made from existing files
Error(E02): Make execution terminated
This is despite forward slashes being accepted by wcl386 in Windows elsewhere on the command-line, eg. "./main.c":
c:\xsrc\fwdslash\src>wcl386 -I..\foo -c ./main.c
Open Watcom C/C++ x86 32-bit Compile and Link Utility
Version 2.0 beta Feb 16 2021 14:25:28 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
wcc386 .\main.c -I..\foo
Open Watcom C x86 32-bit Optimizing Compiler
Version 2.0 beta Feb 16 2021 14:16:42 (32-bit)
Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
Hello from ..\\foo\\bar.h
.\main.c: 4 lines, included 52, 0 warnings, 0 errors
Code size: 13
And obviously forward slashes are accepted by the preprocessor in Windows when using #include <>.
Summary:
"wcl386 -I..\foo main.c" works OK running wcl386 on Windows.
"wcl386 -I../foo main.c" does not.
TLDR:
I'd like to write a makefile that works with both the Linux & Windows of WMake.
This works in Linux:
But the Windows version of wcl386 does not understand the forward slash passed to -I:
This is despite forward slashes being accepted by wcl386 in Windows elsewhere on the command-line, eg. "./main.c":
And obviously forward slashes are accepted by the preprocessor in Windows when using #include <>.
Can this be fixed?
I've resorted to doing:
It works but using $(SEP) is ugly and error-prone as the makefile grows.
Thanks!