admin管理员组

文章数量:1516870

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:

  1. make
    result is a --> OK
  2. make /DCONFIG
    result is b --> ???? why is that?
  3. make /DCONFIG=
    result is 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 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?

本文标签: