Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
makehead.inc
10-27-2017, 12:38 PM (This post was last modified: 10-27-2017 12:39 PM by lingu.)
Post: #11
RE: makehead.inc
(10-12-2017 06:39 PM)zma Wrote:  
(08-20-2017 06:51 PM)lingu Wrote:  makeheadtail.inc is supposed to be included by most of the makefiles around the endbeginning of the makefile.

makeheadtail.inc provides common definitions and assignments, such as the mic file handling, and common targets such as xlimbo and xcloud.

One caveat is that some definitions in maketail.inc may not take effect if there are earlier definitions in the makefile that includes it. We used to use two inclusions, make.inc around the beginning and maketail.inc around the end, to handle definitions and targets separately. But the recent way is to combine them together in maketailhead.inc. makehead.inc is advised to put at the beginning part of the Makefile after some variable assignment if there are any needed by the Makefile. Then we need to be aware of the order of the definitions.

Design

Code:
# default values
GROUND ?= $(HOME)/forest

CXXINCOPT += -I$(GROUND)/util/utilib

CXXLINKOPT += -L$(GROUND)/util/utilib -L$(GROUND)/d-thinker/dt/library/stdlib/cc

# automatically learn the default site at /thinker/etc/soft/site.pcf (if it exists)
# if $site was not yet defined.

mkfile_path := <this makefile's path>
mkfile_dir := $(shell dirname $(mkfile_path))

include $(mkfile_dir)/learnsite.make

# other operations/definations

@lingu

OK.

I think it is advisable to list important vars, such as modname, outline the concrete algorithmic work for 'other operations/definitions'. There should not be much, but it is key to understanding what makehead does, such as learning the config for $modname
Find all posts by this user
Quote this message in a reply
12-06-2017, 09:38 PM
Post: #12
RE: makehead.inc
I ran into a problem and now remember why I split definitions into makehead and make tail.

maketail was implementing goals like 'xlimbo'. If such definitions are included at the beginning, they change the default goal and changes the behavior of 'make' without a specified goal.

This is a problem. I suggest still splitting the goals into a maketail.inc and including them at the end of a makefile.

@zma
Find all posts by this user
Quote this message in a reply
12-06-2017, 10:24 PM (This post was last modified: 12-06-2017 10:34 PM by zma.)
Post: #13
RE: makehead.inc
(12-06-2017 09:38 PM)lingu Wrote:  I ran into a problem and now remember why I split definitions into makehead and make tail.

maketail was implementing goals like 'xlimbo'. If such definitions are included at the beginning, they change the default goal and changes the behavior of 'make' without a specified goal.

This is a problem. I suggest still splitting the goals into a maketail.inc and including them at the end of a makefile.

@zma

A. Changing back to maketail.inc sounds fine.

B. Another way is that we explicitly specify the name of the default target in our system, say 'default'.

In makehead.inc, add

.DEFAULT_GOAL := default

to make `make` use the 'default' as the default target.

C. at the end of makehead.inc, add

.DEFAULT_GOAL :=

to reset the default goal. Then the default goal is the first goal after makehead.inc .

C may be the best way.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-07-2017, 08:01 AM
Post: #14
RE: makehead.inc
(12-06-2017 10:24 PM)zma Wrote:  
(12-06-2017 09:38 PM)lingu Wrote:  I ran into a problem and now remember why I split definitions into makehead and make tail.

maketail was implementing goals like 'xlimbo'. If such definitions are included at the beginning, they change the default goal and changes the behavior of 'make' without a specified goal.

This is a problem. I suggest still splitting the goals into a maketail.inc and including them at the end of a makefile.

@zma

A. Changing back to maketail.inc sounds fine.

B. Another way is that we explicitly specify the name of the default target in our system, say 'default'.

In makehead.inc, add

.DEFAULT_GOAL := default

to make `make` use the 'default' as the default target.

C. at the end of makehead.inc, add

.DEFAULT_GOAL :=

to reset the default goal. Then the default goal is the first goal after makehead.inc .

C may be the best way.

C.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: