llm
llm

Reputation: 737

Why does Borland Make (tested 4.0,5.0,5.2) echoes 'b' when using only /DCONFIG

i need to change a legacy project thats using Borland Make 5.2 (i can't change that) and i try to understand why this makefile im using for testing behaves 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:

  1. make result is a --> OK
  2. make /DCONFIG result is b --> ???? why is that?
  3. make /DCONFIG= result in a --> OK
  4. make /DCONFIG=release result is b --> OK
  5. make /DCONFIG=debug result is c --> OK
  6. make /DCONFIG=invalid result is Fatal makefile 10: Error directive: unknown: invalid --> OK

and its 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)

anyone with old-school knowledge around who can explain?

Upvotes: 0

Views: 32

Answers (0)

Related Questions