DJGPP 使 DOS `多目标模式`

DJGPP make DOS `multiple target patterns`

我在 DOS 下使用 DJGPP make。

这是我的主要 Makefile:

BIN_DIR = bin
OBJ_DIR = obj
DIRS_FOR_CREATION = $(BIN_DIR) $(OBJ_DIR)
SOURCE_DIRS = argparse logger transmission tests

EXECUTABLE_NAME = $(notdir $(shell pwd))
EXECUTABLE_FILE = $(BIN_DIR)/$(EXECUTABLE_NAME)

CC = cc

CFLAGS =
INCLUDES =
LFLAGS =
LIBS =

MAIN_SOURCE = main.c
MAIN_OBJ = $(OBJ_DIR)/main.o

all: directories submodules main $(EXECUTABLE_FILE)
    @echo $(EXECUTABLE_NAME) was compiled

directories:
    mkdir -p $(DIRS_FOR_CREATION)

submodules: 
    $(MAKE) -C $(word 1, $(SOURCE_DIRS))
    $(MAKE) -C $(word 2, $(SOURCE_DIRS))
    $(MAKE) -C $(word 3, $(SOURCE_DIRS))
    $(MAKE) -C $(word 4, $(SOURCE_DIRS))

main:
    $(CC) $(CFLAGS) $(INCLUDES) -c $(MAIN_SOURCE) -o $(MAIN_OBJ)

$(EXECUTABLE_FILE): $(MAIN_SOURCE)
    $(CC) $(CFLAGS) $(INCLUDES) -o $(EXECUTABLE_FILE) $(MAIN_OBJ) $(LFLAGS) $(LIBS)

这在 QNX 上完美运行,但在 DOSBox 中我收到以下错误:

makefile:19: *** multiple target patterns. Stop.

19 行是 all: directories submodules main $(EXECUTABLE_FILE)。我应该怎么做才能解决这个问题?

您应该添加:

$(info EXECUTABLE_NAME = '$(EXECUTABLE_NAME)')
$(info EXECUTABLE_FILE = '$(EXECUTABLE_FILE)')

这样您就可以看到该变量包含的内容。我怀疑它包含一个冒号(:),这是特别制作的。