I need to change a legacy project that's using Borland Make 5.2 (I can't change that) and I'm trying to understand why this makefile I'm using for testing is behaving so strange.
The make.exe
5.2 is available in the free Borland 5.5 C++ compiler package.
MY=a
!ifdef CONFIG
!if ($(CONFIG)==release)
MY=b
!elif ($(CONFIG)==debug)
MY=c
!else
!error unknown: $(CONFIG)
!endif
!endif
all:
@echo $(MY)
When I run with:
make
result isa
--> OKmake /DCONFIG
result isb
--> ???? why is that?make /DCONFIG=
result isa
--> OKmake /DCONFIG=release
result isb
--> OKmake /DCONFIG=debug
result isc
--> OKmake /DCONFIG=invalid
result isFatal makefile 10: Error directive: unknown: invalid
--> OK
And it's also very indent fragile (same makefile).
This gives just an error:
Error makefile 14: Unexpected end of file in conditional started at line 2
MY=a
!ifdef CONFIG
!if ($(CONFIG)==release)
MY=b
!elif ($(CONFIG)==debug)
MY=c
!else
!error unknown: $(CONFIG)
!endif
!endif
all:
@echo $(MY)
Can anyone with old-school knowledge explain this?