Reputation: 856
I am trying to write a make file for my project and I am trying to debug issues using
make -n
command and I finally got it down to
Fatal error: can't create /bin/st_driver.o: Permission denied
and I can't for the life of me figure out what is going on.
My code is
CC=gcc
CFLAGS=-g -Wall
TARGETS=st_driver
.PHONY: all clean dist
all: ./${TARGETS}
st_driver: bin/st_driver.o bin/st.o bin/er.o bin/hashtable.o
${CC} ${CFLAGS} -o st_driver bin/st_driver.o bin/st.o bin/er.o bin/hashtable.o
bin/st_driver.o: src/drivers/st_driver.c src/include/st.h
${CC} ${CFLAGS} -o /bin/st_driver.o -c src/drivers/st_driver.c
bin/st.o: src/st/st.c src/include/st.h
${CC} ${CFLAGS} -c src/st/st.c -o bin/st.o
bin/er.o: src/er/er.c src/include/er.h
${CC} ${CFLAGS} -c src/er/er.c -o bin/er.o
bin/hashtable.o: src/util/hashtable.c src/include/hashtable.h
${CC} ${CFLAGS} -c src/util/hashtable.o -o bin/hashtable.o
bin/list.o: src/util/list.c include/list.h
${CC} ${CFLAGS} -c src/util/list.c -o bin/list.o
clean:
rm -rf bin/*
run_valgrind: ${TARGETS}
valgrind -v --leak-check=yes bin/CS480_pcc
Upvotes: 0
Views: 355
Reputation: 1413
Problem's here:
bin/st_driver.o: src/drivers/st_driver.c src/include/st.h
${CC} ${CFLAGS} -o /bin/st_driver.o -c src/drivers/st_driver.c
You are referring to /bin/st_driver.o
, and you wanted to refer to bin/st_driver.o
.
Upvotes: 5