help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How make finds its targets?


From: Arsen Hayrapetyan
Subject: How make finds its targets?
Date: Tue, 21 Aug 2007 13:40:14 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20070719)

Hello,

I have the following Makefile in the top-level directory of the source-tree:
============================================================
TOP    = .
include $(TOP)/Makefile.global-vars
SUBDIRS    = \
   src \
   docs

.PHONY:    default  install-pub

default::    $(SUBDIRS)
install-pub::        install-common-parts
install-common-parts::
       @if [ $(package_build) != "yes" ]; then \
echo installing common components because it is not a package build; \
           $(MAKE) install-common; \
       else \
echo not installing common components because it is a package build; \
       fi

$(SUBDIRS)::
       cd $@ && $(MAKE) $(SUBTARGET)
====================================================================

The directory has subdirectories src and docs.
When I run 'gmake install-pub' I can see that make descends into src directory and runs Makefile there,
here is the output:
============================================================
installing common components because it is not a package build
gmake[1]: Entering directory `/localscratch/home/ahairape/openca-0.9.3-rc1'
gmake src docs SUBTARGET=install-common
gmake[2]: Entering directory `/localscratch/home/ahairape/openca-0.9.3-rc1'
cd src && gmake install-common
gmake[3]: Entering directory `/localscratch/home/ahairape/openca-0.9.3-rc1/src'
=============================================================

Can anybody explain how make decides to consider target 'src'?
I assume the following scenario:
1) Make considers target 'install-pub' and finds that it has a prerequisite 'install-common-parts' 2) Make considers target 'install-common-parts' and finds that it is in double-colon rule which has no prerequisites, so it goes to the execution of commands of that rule 3) As I do not pass --enable-package-build to configure script, the $(package_build) is "no" and Make ends up with the command: "$(MAKE) install-common;"

Now, how Make finds the 'install-common' target?
The file Makefile.global-vars is attached to this message, but it seems not to contain anything helpful.

Thanks in advance for your help,
Arsen.
# file: Makefile.global-vars(.in)
# contains all the configured settings
#
# © 2001 OpenCA Group

VERSION                 = 0.9.3-rc1
TODAY                   = 20061009
TRANSLATIONS            = de_DE el_GR en_GB es_ES fr_FR it_IT ja_JP pl_PL sl_SI 
ru_RU
LOCALES                 = C $(TRANSLATIONS)


#-------- installation paths: --------

prefix                  = $(DESTDIR)/var/openca
exec_prefix             = /var/openca
openca_tools_prefix     = @openca_tools_prefix@

batch_htdocs_fs_prefix  = $(DESTDIR)/var/openca/www/htdocs/batch
batch_htdocs_url_prefix = @batch_htdocs_url_prefix@
batch_cgi_fs_prefix     = $(DESTDIR)/var/openca/www/cgi-bin/batch
batch_cgi_url_prefix    = @batch_cgi_url_prefix@

ca_htdocs_fs_prefix     = $(DESTDIR)/var/openca/www/htdocs/ca
ca_htdocs_url_prefix    = @ca_htdocs_url_prefix@
ca_cgi_fs_prefix        = $(DESTDIR)/var/openca/www/cgi-bin/ca
ca_cgi_url_prefix       = @ca_cgi_url_prefix@

node_htdocs_fs_prefix   = $(DESTDIR)/var/openca/www/htdocs/node
node_htdocs_url_prefix  = @node_htdocs_url_prefix@
node_cgi_fs_prefix      = $(DESTDIR)/var/openca/www/cgi-bin/node
node_cgi_url_prefix     = @node_cgi_url_prefix@
 
ra_htdocs_fs_prefix     = $(DESTDIR)/var/openca/www/htdocs/ra
ra_htdocs_url_prefix    = @ra_htdocs_url_prefix@
ra_cgi_fs_prefix        = $(DESTDIR)/var/openca/www/cgi-bin/ra
ra_cgi_url_prefix       = @ra_cgi_url_prefix@
 
ldap_htdocs_fs_prefix   = $(DESTDIR)/var/openca/www/htdocs/ldap
ldap_htdocs_url_prefix  = @ldap_htdocs_url_prefix@
ldap_cgi_fs_prefix      = $(DESTDIR)/var/openca/www/cgi-bin/ldap
ldap_cgi_url_prefix     = @ldap_cgi_url_prefix@
 
pub_htdocs_fs_prefix    = $(DESTDIR)/var/openca/www/htdocs/pub
pub_htdocs_url_prefix   = @pub_htdocs_url_prefix@
pub_cgi_fs_prefix       = $(DESTDIR)/var/openca/www/cgi-bin/pub
pub_cgi_url_prefix      = @pub_cgi_url_prefix@

scep_cgi_fs_prefix      = $(DESTDIR)/var/openca/www/cgi-bin/scep
scep_cgi_url_prefix     = @scep_cgi_url_prefix@

batch_prefix            = batch
ca_prefix               = ca
node_prefix             = node
ra_prefix               = ra
ldap_prefix             = ldap
pub_prefix              = pub
scep_prefix             = scep

etc_prefix              = $(DESTDIR)/var/openca/etc
lib_prefix              = $(DESTDIR)/var/openca/lib
var_prefix              = $(DESTDIR)/var/openca/var
doc_prefix              = $(prefix)/share/doc/openca

db_module               = @db@
dbi_module              = @dbi@
rbac_module             = @rbac@

DEST_BINDIR             = $(DESTDIR)${exec_prefix}/bin
DEST_DATADIR            = $(DESTDIR)${prefix}/share
DEST_INFODIR            = $(DESTDIR)${prefix}/info
DEST_LIBDIR             = $(DESTDIR)${exec_prefix}/lib
DEST_MANDIR             = $(DESTDIR)${prefix}/man
DEST_SBINDIR            = $(DESTDIR)${exec_prefix}/sbin

DEST_DIR                = 

#-------- for installation as writable by the httpd: --------

httpd_user              = apache
httpd_group             = apache

#-------- for installation as not writable by the httpd: --------

openca_user             = root
openca_group            = nobody

#-------- for distribution building: --------

dist_user               = madwolf
dist_group              = openca
package_build           = yes

#-------- build and utility programs: --------


SHELL                   = /bin/sh
GZIP                    = /usr/bin/gzip
TAR                     = /bin/tar
PWD                     = /home/madwolf/devel/openca-new-packaging/openca-base
## sometimes "-D -c" must be added here
INSTALL                 = /usr/bin/install -c
MKDIR                   = /bin/mkdir
CHMOD                   = /bin/chmod
CHOWN                   = /bin/chown
ECHO                    = /bin/echo
SED                     = /bin/sed
CAT                     = /bin/cat
MV                      = /bin/mv
CP                      = /bin/cp
LN_S                    = ln -s
AWK                     = gawk
CC                      = gcc
RM                      = rm

OPENCA_SV               = openca-sv
OPENCA_SCEP             = openca-scep

PERL                    = /usr/bin/perl
OPENSSL                 = /usr/bin/openssl
OPENSSL_PREFIX          = /usr

POD2MAN                 = /usr/bin/pod2man

EXTERNAL_MODULES        = yes
# OPTIONAL_C_MODULES    = @OPTIONAL_C_MODULES@
PERL_MAKEFILE_OPTS      = PREFIX=/var/openca/perl-modules/perl5 
LIB=/var/openca/perl-modules/perl5 
INSTALLMAN1DIR=/var/openca/perl-modules/man/man1 
INSTALLMAN3DIR=/var/openca/perl-modules/man/man3

## this is an implementation of GNU's "install -D"
__install_dir::
        @if test -z "$(DIR)"; then $(MAKE) default; \
        else \
            if test ! -d $(DIR); then \
                $(MAKE) __install_dir DIR=`dirname $(DIR)`; \
                if test -n "$(MODE)"; then \
                        set -x; \
                        $(INSTALL) -d -o $(USER) -g $(GROUP) -m $(MODE) $(DIR); 
\
                else \
                        set -x; \
                        $(INSTALL) -d -o $(USER) -g $(GROUP) $(DIR); \
                fi; \
            fi; \
        fi;

## this is an implementation of relative linking
## it is required to support symlink during installs
## with DEST_DIR in use (package builds)
__install_ln_s::
        if test -z "$(TARGET)"; then $(MAKE) default; \
        else \
            $(TOP)/relative_ln_s.sh $(TARGET) $(LINK); \
        fi;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]