I am following https://www.debian.org/doc/manuals/debm ... 04.en.html to start with Debian
I am running Debian in linux which is being running with VirtualMachine
In the section of 4.5 of the link which I posted, I see such makefile code
Code: Select all
$ cat debhello-0.0/Makefile
prefix = /usr/local
all: src/hello
src/hello: src/hello.c
@echo "CFLAGS=$(CFLAGS)" | \
fold -s -w 70 | \
sed -e 's/^/# /'
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDCFLAGS) -o $@ $^
install: src/hello
install -D src/hello \
$(DESTDIR)$(prefix)/bin/hello
clean:
-rm -f src/hello
distclean: clean
uninstall:
-rm -f $(DESTDIR)$(prefix)/bin/hello
.PHONY: all install clean distclean uninstall
This is a makefile which I have:
Code: Select all
prefix = /usr/local
all: electrotest
electrotest: electrotest_standalone.c
gcc -o electrotest_standalone electrotest_standalone.c -lm
install:electrotest
install -D electrotest_standalone \
$(DESTDIR)$(prefix)/bin/electrotest_standalone
clean:
-rm -f electrotest_standalone
distclean:clean
uninstall:
-rm -f $(DESTDIR)$(prefix)/bin/electrotest_standalone
What am I doing wrong here? I heard sudo make install should fix the problem, but I am not sure if it is safe to run the command with sudo in this situation...gcc -o electrotest_standalone electrotest_standalone.c -lm
install -D electrotest_standalone \
/usr/local/bin/electrotest_standalone
install: cannot create regular file '/usr/local/bin/electrotest_standalone': Permission denied
makefile:8: recipe for target 'install' failed
make: *** [install] Error 1