Answer the question
In order to leave comments, you need to log in
Is it correct to write a Makefile?
Hello!
I have a utility that is assembled by the simplest call to gcc
gcc -I/usr/pgsql-9.4/include -lncurses -lpq -L/usr/pgsql-9.4/lib -o hello hello.c
PROGRAM_NAME = hello
SOURCE = hello.c
PREFIX = /usr
LIBS = -lncurses -lpq -L/usr/pgsql-9.4/lib
INCLUDE = -I/usr/pgsql-9.4/include
.PHONY: all clean install
all: hello
hello: hello.c
gcc $(INCLUDE) $(LIBS) -o $(PROGRAM_NAME) $(SOURCE)
clean:
rm -f $(PROGRAM_NAME)
install:
install $(PROGRAM_NAME) $(PREFIX)/bin
Answer the question
In order to leave comments, you need to log in
It is advisable to use automatic parameter generators.
For ncurses, consider ncurses-config (available in the Debian repositories, for example). Sample output for this utility on my system:
[email protected]:~$ ncurses5-config --cflags
[email protected]:~$ ncurses5-config --libs
-lncurses -ltinfo
[email protected]:~$ ncurses5-config --libdir
/usr/lib/x86_64-linux-gnu
[email protected]:~$ ncurses5-config --includedir
/usr/include
[email protected]:~$
PGLIBS = $(shell pg-config --libs)
NCURSESLIBS = $(shell ncurses5-config --libs)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question