Help, how to compile makefile

Started by PSL, Jul 07, 2024, 01:26 PM

Previous topic - Next topic

PSL

I tried to compile the makefile file in vscode, but the following problem occurred.Is there something wrong with the file itself?

C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe BITCOUNT=32 BUILDTYPE=rel xbuild
make[1]: Entering directory 'C:/Users/Administrator/Desktop/stormeus-0.4-announce-c1f737aaddce/0.4-announce' The command syntax is incorrect.
make[1]: *** [Makefile:56: objdir/rel32/./main.o] Error 1
make[1]: Leaving directory 'C:/Users/Administrator/Desktop/stormeus-0.4-announce-c1f737aaddce/0.4-announce'
make: *** [Makefile:32: build32] Error 2

I can compile the following normally:
main.cc
#include <stdio.h>

int main(int argc, char*argv[]) {
    printf("test\n");
    return 0;
}

Makefile
.PHONY: all clean

CC := gcc
CXX := g++
CFLAGS :=
CXXFLAGS := -gdwarf-4
Target := main

SRCS += $(wildcard *.cc)
OBJS := $(patsubst %.cc, %.o, ${SRCS})

all: $(Target)

$(Target): $(OBJS)
    $(CXX) $(CXXFLAGS) $(OBJS) -o $@

%.o: %.cc
    $(CXX) $(CXXFLAGS) -c $? -o $@

clean:
    rm -rf $(OBJS) $(Target)