MakeFile Archaeology

From HELIOS Digital DAQ
Jump to navigation Jump to search

Digging up the make file and all that it refers to

We start with the makefile itself, found at /global/devel/gretTop/9-22/dgsDrivers. The makefile presumes that it is being run from the top of the development tree, setting internal variable TOP to ".".

  • The makefile then includes the contents of the file /global/devel/gretTop/9-22/dgsDrivers/configure/CONFIG.
    • This file includes the file /global/devel/gretTop/9-22/dgsDrivers/configure/CONFIG_APP but all other lines are commented out.
      • File /global/devel/gretTop/9-22/dgsDrivers/configure/CONFIG_APP itself then pulls in /global/devel/gretTop/9-22/dgsDrivers/configure/RELEASE but the other files are not included because the "-include" directive means "do not include". Guess that's a backwards way to comment out the line.
   Thus at this point in the make what has realled happened is that we've pulled in /global/devel/gretTop/9-22/dgsDrivers/configure/RELEASE but nothing else has occurred.

File /global/devel/gretTop/9-22/dgsDrivers/configure/RELEASE

  • defines a variable TEMPLATE_TOP that is not used later within this file, and is dependent upon the definition of the variable EPICS_BASE that occurs later in this same file.
  • defines a variable GRETVME that parses out to /global/devel/gretTop/9-22/gretVME.
  • defines a variable DATASERVER that parses out to /global/devel/gretTop/9-22/gretClust.
  • defines a variable SNCSEQ to /global/develbuild/supTop/31410/sncseq-2.0.12.
    • Obscure comment about needing SNCSEQ defined "if using the sequencer", but at this point we don't know what a "sequencer" is.
  • defines a variable ASYN to /global/develbuild/synApps/asyn4-17.
    • No comment available but we guess that this is intended for later use to bring in the ASYN driver C++ stuff later.
  • defines the variable EPICS_BASE to the value /global/develbuild/base/base-3.14.12.1.
    • This is probably something that will be dependent upon which processor is in use as different processors may have different versions of EPICS.
  • and then a couple more commented-out lines.


   So at this point we have 
   Variable TOP is set to /global/devel/gretTop/9-22/dgsDrivers.
   Variable GRETVME is set to /global/devel/gretTop/9-22/gretVME.
   Variable DATASERVER is set to /global/devel/gretTop/9-22/gretClust.
   Variable SNCSEQ is set to /global/develbuild/supTop/31410/sncseq-2.0.12.
   Variable ASYN is set to /global/develbuild/synApps/asyn4-17.
   Variable EPICS_BASE is set to /global/develbuild/base/base-3.14.12.1.
   Variable TEMPLATE_TOP is set to /global/develbuild/base/base-3.14.12.1/templates/makeBaseApp/top, because that is done with "=" (deferred assignment) as opposed to ":=" (immediate assignment).

At this point we've run down the chain of includes from /global/devel/gretTop/9-22/dgsDrivers/configure/CONFIG at the top of the makefile. We now recurse back to the original makefile (found at /global/devel/gretTop/9-22/dgsDrivers/Makefile) to see what happens after the first include.

Back up to original makefile

  • after including $(TOP)/configure/CONFIG, parsed out above, the main makefile then builds up the value to be stored in the variable DIRS. It is inobvious until you read up on make, but the lines that say DIRS := ($DIRS) $(blahblahblah) is an implied concatenation, identical to DIRS += $(blahblahblah).
  • the five lines with DIRS := are then a series of concatenations to fill DIRS with a list of values.
  • Each of the value lists uses the filter-out operator, defined as
    $(filter-out pattern…,text)
    Returns all whitespace-separated words in text that do not match any of the pattern words, removing the words that do match one or more. This is the exact opposite of the filter function.
  • The lines defining DIRS are not understood at this point, because we don't know what DIRS was originally defined to be; thus we can't understand why certain parts of an unknown tree are being excluded.

main Makefile now includes $(TOP)/configure/RULES_TOP.

  • In what comes as no surprise at all, all this file does is include some other file $(EPICS_BASE)/configure/RULES_TOP. That parses out to /global/develbuild/base/base-3.14.12.1/configure/RULES_TOP.

What does RULES_TOP do?

The first thing RULES_TOP does is include RULES_DIRS, but after that RULES_TOP actually has some real actions. RULES_DIRS doesn't seem to include anything else, so we may have dug to the point where we can copy/paste from this tree of includes into a flat makefile that we can decode.

Flattened Makefile 1

Now for the 2nd makefile in the usual build

The first makefile seems to be completely involved in building EPICS with nothing particularly specific to a given experiment. The second makefile we usually run is found at /global/devel/gretTop/9-22/dgsIoc/Makefile.

In what should be no surprise it looks the same as the other one, but probably some sub-included makefile is different.

#Makefile at top of application tree
TOP = .
include $(TOP)/configure/CONFIG
DIRS := $(DIRS) $(filter-out $(DIRS), configure)
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *App))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard *app))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard iocBoot))
DIRS := $(DIRS) $(filter-out $(DIRS), $(wildcard iocboot))
include $(TOP)/configure/RULES_TOP
 

Flattening the 2nd makefile