0

make append and separate by white space
https://superuser.com/questions/360178/what-does-make-install-do
Trying to understand the following make command.

installincludes:
    $(INSTALL) -d '$(DESTDIR)$(includedir_server)/'
    $(INSTALL_DATA) $(addprefix $(srcdir)/, $(RELATIVE_INCLUDES)) '$(DESTDIR)$(includedir_server)/'

rg is rigrep regex command, like grep.
To understand this, I first begin with includedir_server.

 pg_config | rg server

return

INCLUDEDIR-SERVER = /usr/include/postgresql/15/server

In folder /src (postgresql source code) do

cat Makefile.global.in | rg --line-number 'includedir_server'

return

170:includedir_server = $(pkgincludedir)/server
248:override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)

To understand $(INSTALL) -d '$(DESTDIR)$(includedir_server)/' now I feel like the follow logic is true.

$(includedir_server)  ==  $(pkgincludedir)/server  == /usr/include/postgresql/15/server

But if the above logic is true, then $(includedir_server) is already a full path. Then what is $(DESTDIR)? also $(INSTALL) -d what does this part do?

1 Answer 1

2

DESTDIR is intended for use when you want to install somewhere other than the real target path, for example if you’re preparing a package or if you’re installing into a chroot from outside. You won’t find it defined in the build, it’s specified externally when necessary (see Cross-compilation: running `make install` on the build (non-target) system).

$(INSTALL) -d creates the directory given as argument.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.