summaryrefslogtreecommitdiff
path: root/dmake/startup/startup.mk
blob: 524ad1efba267b7022f4ee63c56c5f1cd6f18e60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# This is the root DMAKE startup file.
#
# Definitions common to all environments are given at the root.
# Definitions parameterized at the root have their parameters specified
# in sub-makefiles which are included based on the values of the three
# make variables:
#
#	OS		- core operating system flavour
#	OSRELEASE	- specific release of the operating system
#	OSENVIRONMENT	- software construction environment in use
# 
# See the file 'summary', found in this directory for a list of
# environments supported by this release.

# Disable warnings for macros given on the command line but redefined here.
__.silent !:= $(.SILENT)	# Preserve user's .SILENT flag
.SILENT   !:= yes

# startup.mk configuration parameters, for each, set it to non-null if you wish
# to enable the named facility.
__.HAVE_RCS  !:= yes 		# yes => RCS  is installed.
__.HAVE_SCCS !:=    		# yes => SCCS is installed.
__.DEFAULTS  !:= yes		# yes => define default construction rules.
__.EXECS     !:= yes            # yes => define how to build executables.

# Grab key definitions from the environment
# The variables OS OSRELEASE OSENVIRONMENT were removed from this
# list because of windows. See issue 43254 for details. 
.IMPORT .IGNORE : TMPDIR SHELL

# Default DMAKE configuration, if not overriden by environment
.INCLUDE .NOINFER $(!null,$(OS) .IGNORE) : $(INCFILENAME:d)config.mk

# Look for a local defaults configuration
.INCLUDE .NOINFER .IGNORE : $(INCFILENAME:d)local.mk

# Define the directory separator string.
/ *=  $(DIRSEPSTR)

# Customize macro definitions based on setings of OS, OSRELEASE and
# OSENVIRONMENT, this must come before the default macro definitions which
# follow.
.INCLUDE .NOINFER .IGNORE : $(INCFILENAME:d)$(OS)$/macros.mk

# ----------------- Default Control Macro definitions -----------------------
# Select appropriate defaults for basic macros
   MAKE          *=  $(MAKECMD) -S $(MFLAGS)
   TMPDIR        *:= $/tmp
   DIVFILE       *=  $(TMPFILE)
   AUGMAKE       *:= no

# Recipe execution configuration
   SHELL	 *:= $/bin$/sh
   SHELLFLAGS	 *:= -ce
   GROUPSHELL	 *:= $(SHELL)
   GROUPFLAGS	 *:= 
   SHELLMETAS	 *:= |();&<>?*][$$:\\#`'"
   GROUPSUFFIX	 *:=

# Intermediate target removal configuration
   RM            *:= $/bin$/rm
   RMFLAGS       *=  -f
   RMTARGET      *=  $<

# Default recipe that is used to remove intermediate targets.
.REMOVE :; $(RM) $(RMFLAGS) $(RMTARGET)

# Check and enable AUGMAKE extensions for SYSV compatibility
.IF $(AUGMAKE)
   "@B" != $(@:b)
   "@D" != $(@:d)
   "@F" != $(@:f)
   "*B" != $(*:b)
   "*D" != $(*:d)
   "*F" != $(*:f)
   "<B" != $(<:b)
   "<D" != $(<:d)
   "<F" != $(<:f)
   "?B" != $(?:b)
   "?F" != $(?:f)
   "?D" != $(?:d)
.ENDIF

# Directory caching configuration.
  .DIRCACHE         *:= yes
  .DIRCACHERESPCASE *:= yes

# Define the special NULL Prerequisite
NULLPRQ *:= __.NULLPRQ

# ---------- Default Construction Macro and Rule definitions --------------
# The construction rules may be customized further in subsequent recipes.mk
# files.
.IF $(__.DEFAULTS)
   # Primary suffixes in common use
   A          *:= .a		# Libraries
   E          *:= 		# Executables
   F          *:= .f		# Fortran
   O          *:= .o		# Objects
   P          *:= .p		# Pascal
   S          *:= .s		# Assembler sources
   V          *:= ,v		# RCS suffix
   YTAB	      *:= y.tab		# name-stem for yacc output files.
   LEXYY      *:= lex.yy	# lex output file

   # Standard C-language command names and flags
   CPP	      *:= $/lib$/cpp	# C-preprocessor
   CC         *:= cc		# C   compiler 
   CFLAGS     *=		# C   compiler flags
   "C++"      *:= CC		# C++ Compiler
   "C++FLAGS" *=                # C++ Compiler flags

   AS         *:= as		# Assembler and flags
   ASFLAGS    *= 

   LD         *= $(CC)		# Loader and flags
   LDFLAGS    *=
   LDLIBS     *=		# Default libraries

   AR         *:= ar		# archiver
   ARFLAGS    *= -rv

   # Definition of Print command for this system.
   PRINT      *= lp

   # Language and Parser generation Tools and their flags
   YACC	      *:= yacc		# standard yacc
   YFLAGS     *=
   LEX	      *:= lex		# standard lex
   LFLAGS     *=

   # Other Compilers, Tools and their flags
   PC	      *:= pc		# pascal compiler
   RC	      *:= f77		# ratfor compiler
   FC	      *:= f77		# fortran compiler
   MV	      *:= $/bin$/mv     # File rename command

   # Implicit generation rules for making inferences.
   # lex and yacc rules
   %.c : %.y %.Y
    $(YACC) $(YFLAGS) $<
    $(MV) $(YTAB).c $@

   %.c : %.l %.L
    $(LEX) $(LFLAGS) $<
    $(MV) $(LEXYY).c $@

   # Rules for making *$O
   %$O : %.c ; $(CC) $(CFLAGS) -c $<
   %$O : %$P ; $(PC) $(PFLAGS) -c $<
   %$O : %$S ; $(AS) $(ASFLAGS) -o $@ $<
   %$O : %.cl ; class -c $<
   %$O :| %.e %.r %.F %$F
    $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<

   # Defibe how to build simple executables
   .IF $(__.EXECS)
      %$E : %$O ; $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
   .ENDIF

   # Recipe to make archive files, defined only if we have
   # an archiver defined.
   .IF $(AR)
      %$A .SWAP .GROUP :
    $(AR) $(ARFLAGS) $@ $?
    $(RM) $(RMFLAGS) $?
   .ENDIF

   # RCS support
   .IF $(__.HAVE_RCS)
      CO      *:= co		# check out for RCS
      COFLAGS !+= -q

      % : $$(@:d)RCS$$/$$(@:f)$V
    -$(CO) $(COFLAGS) $(null,$(@:d) $@ $(<:d:s/RCS/)$@)
      .NOINFER : $$(@:d)RCS$$/$$(@:f)$V

      .IF $V
         % : %$V
        -$(CO) $(COFLAGS) $(null,$(@:d) $@ $(<:d:s/RCS/)$@)
         .NOINFER : %$V
      .ENDIF
   .END

   # SCCS support
   .IF $(__.HAVE_SCCS)
      GET     *:= get
      GFLAGS  !+=

      % : "$$(null,$$(@:d) s.$$@ $$(@:d)s.$$(@:f))"
    -$(GET) $(GFLAGS) $@
      .NOINFER : "$$(null,$$(@:d) s.$$@ $$(@:d)s.$$(@:f))"
   .END

   # Customize default recipe definitions for OS, OSRELEASE, etc. settings.
   .INCLUDE .NOINFER .IGNORE: $(INCFILENAME:d)$(OS)$/recipes.mk
.ENDIF


# Finally, define the default construction strategy
.ROOT .PHONY .NOSTATE .SEQUENTIAL :- .INIT .TARGETS .DONE;
.INIT .DONE .PHONY: $(NULLPRQ);

# Define the NULL Prerequisite as having no recipe.
$(NULLPRQ) .PHONY :;

# Reset warnings back to previous setting.
.SILENT !:= $(__.silent)

# Check for a Local project file, gets parsed before user makefile.
.INCLUDE .IGNORE .NOINFER: "project.mk"