I have a makefile which is just not working. Can you guys help me to find where the error is? Thanks!
CC = gcc
FILES = workfile.c insert.c
TARGETS = exe
CFLAGS = -o
DBUG =
RM = rm -f
OBJS = *.o
#Master Rule
all: $(TARGETS)
#Build
exe: workfile.o insert.o
$(CC) $(CFLAGS) $(DBUG) workfile.o insert.o exe
#workfile
workfile.o: workfile.c
$(CC) $(DBUG) -c *.c
insert.o: insert.c
$(CC) $(DBUG) -c *.c
clean:
$(RM) $(TARGETS) $(OBJS)
The error is as follows
$make all
gcc -c *.c
gcc -o workfile.o insert.o exe
gcc: error: exe: No such file or directory
make: *** [exe] Error 1
I even tried changing the names of the targets. But did not help. Could not continue further.
I don’t think it is a good idea to put
-oinCFLAGS, I would rather to remove-ofrom it.CFLAGS = -o->CFLAGS =Now you can work on your
exe, the output path should follow-oimmediately.=>
So the full makefile should look like: