UPDATE: The tabulation error has been fixed. so I am changing the scope of this issue to focus on error 2. I would like to keep this same post as there has been some valuable discussion.
I am attempting to run this Makefile on Windows, but it gives the error "missing separator". I did some googling, and it seems like this issue stems from having spaces instead of a tab. I opened up the file in notepad++ and it seems like all the tabs are placed correctly. Is there another syntax issue that would throw this error? It should be noted that this compiles perfectly fine on Ubuntu 18.04, therefore I am not entirely sure what the issue may be.
Code here:
# where the executables should be installed:
BIN = $HOME/bin
# define your compiler here:
CC = gcc
# define your copy command here:
COPY = cp
# define your remove (or delete) command here:
RM = rm -f
# suffix of object files? (o for unix, obj for MSDOS):
O = o
# suffix for executable files? (empty for unix, .exe for dos):
E =
# command line arguments for C compiler
WARN := \
-Wall \
-Wcast-align \
-Wcast-qual \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wpointer-arith \
-Wstrict-prototypes \
-Wno-unused-parameter \
-Wno-unused-function \
-Wshadow \
-Wundef \
-Wwrite-strings
OPT1 = -DNDEBUG
#OPT2 = -O
CFLAGS = -g $(WARN) $(OPT1) $(OPT2)
#
# There should be no need to make changes below this line
#
TARGETS = abcml$(E) abcsim$(E) tabcfg$(E) mau2cfg$(E) cplcfg$(E) gnaw$(E) \
wgtcfg$(E)
#make all targets
all : $(TARGETS)
touch all
#target wgtcfg: Weight the configurations in a .cfg file
WGTCFG = wgtcfg.$(O) getcic.$(O) io.$(O) header.$(O) misc.$(O) zeroin.$(O)
wgtcfg$(E) : $(WGTCFG)
$(CC) $(CFLAGS) -o $@ $(WGTCFG) -lm
#target gnaw: subject an assemblage to attrition
GNAW = gnaw.$(O) getcic.$(O) io.$(O) header.$(O) misc.$(O) zeroin.$(O) \
unirand.$(O)
gnaw$(E) : $(GNAW)
$(CC) $(CFLAGS) -o $@ $(GNAW) -lm
#target cplcfg: Calculate complement of .cfg file
CPLCFG = cplcfg.$(O) getcic.$(O) io.$(O) header.$(O) misc.$(O) zeroin.$(O)
cplcfg$(E) : $(CPLCFG)
$(CC) $(CFLAGS) -o $@ $(CPLCFG) -lm
#target mau2cfg: convert .mau format to .cfg format
MAU2CFG = mau2cfg.$(O) getcic.$(O) misc.$(O) io.$(O) header.$(O) zeroin.$(O)
mau2cfg$(E) : $(MAU2CFG)
$(CC) $(CFLAGS) -o $@ $(MAU2CFG) -lm
#target abcsim: simulation program
ABCSIM = abcsim.$(O) getcic.$(O) zeroin.$(O) misc.$(O) io.$(O) unirand.$(O) \
header.$(O)
abcsim$(E) : $(ABCSIM)
$(CC) $(CFLAGS) -o $@ $(ABCSIM) -lm
#target abcml: estimation program
ABCML = abcml.$(O) io.$(O) getcic.$(O) zeroin.$(O) misc.$(O) likelihood.$(O) \
prlike.$(O) chol.$(O) amoeba.$(O) symeig.$(O) unirand.$(O) header.$(O) \
ninfomat.$(O)
abcml$(E) : $(ABCML)
$(CC) $(CFLAGS) -o $@ $(ABCML) -lm
#target tabcfg: tabulate configurations
TABCFG = tabcfg.$(O) getcic.$(O) misc.$(O) io.$(O) header.$(O) zeroin.$(O)
tabcfg$(E) : $(TABCFG)
$(CC) $(CFLAGS) -o $@ $(TABCFG) -lm
install : all
$(COPY) $(TARGETS) $(BIN)
clean :
$(RM) *.$(O) *~ all bone junk* core abcmlsrc.zip try depend $(TARGETS)
abcmlsrc.zip :
zip -l abcmlsrc LICENSE Makefile.dos Makefile.unix *.c *.h -x try.*
depend :
echo '#Automatically generated dependency info' > depend
$(CC) -M *.c >> depend
include depend
EDIT: Whew, ok, so fixing the error in the depend file leads to another wonderful error which can be pictured here below (The bit of mandarin states: "The system can not find the file specified"). Fixing the depend file now allows it to compile properly using WSL, but PowerShell is still not happy. Should I try to use a different compiler? My goal is to get the executable file from running make so I can do stuff with it.
gcc -g -Wall -Wcast-align -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith -Wstrict-prototypes -Wno-unused-parameter -Wno-unused-function -Wshadow -Wundef -Wwrite-strings -DNDEBUG -c -o wgtcfg.o wgtcfg.c
process_begin: CreateProcess(NULL, gcc -g -Wall -Wcast-align -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith -Wstrict-prototypes -Wno-unused-parameter -Wno-unused-function -Wshadow -Wundef -Wwrite-strings -DNDEBUG -c -o wgtcfg.o wgtcfg.c, ...) failed.
make (e=2): 系统找不到指定的文件。
make: *** [<builtin>: wgtcfg.o] Error 2