RN rnmake  3.0.0
Makefile
Go to the documentation of this file.
1 ################################################################################
2 #
3 # templates/Makefile
4 #
5 ifdef RNMAKE_DOXY
6 /*!
7 \file
8 
9 \brief General [Sub]Pacakge Makefile Template.
10 
11 Version 3.0
12 
13 $(RNMAKE_PKG_ROOT)[/subdirs]/Makefile
14 
15 Copy this file to the package [sub]directory and redefine.
16 Any define that is not required can be left blank or deleted.
17 
18 Typically there are 3 distinct flavors used under a package:
19 - Subdirectory makefile to simply redirect to subdirectories
20 - Library subdirectory to make libraries
21 - Program subdirectory to make applications
22 
23 \pkgsynopsis
24 RN Make System
25 
26 \pkgfile{templates/Makefile}
27 
28 \pkgauthor{Robin Knight,robin.knight@roadnarrows.com}
29 
30 \pkgcopyright{2005-2018,RoadNarrows LLC,http://www.roadnarrows.com}
31 
32 \license{MIT}
33 
34 \EulaBegin
35 \EulaEnd
36 
37 \cond RNMAKE_DOXY
38  */
39 endif
40 #
41 ################################################################################
42 
43 #------------------------------------------------------------------------------
44 # Required
45 
46 #
47 # Package Root Directory
48 #
49 # Required in each Makefile
50 #
51 # Examples: . .. ../..
52 #
53 RNMAKE_PKG_ROOT = .
54 
55 #
56 # Top Build Directory
57 #
58 # Required in each Makefile
59 #
60 topdir = $(realpath $(RNMAKE_PKG_ROOT)/..)
61 
62 # Path to RoadNarrows Make System
63 #
64 # Package Top Directory.
65 #
66 # Required in each Makefile
67 #
68 # Examples: /prj/rnmake $(topdir)/rnmake
69 #
70 rnmake = $(topdir)/rnmake
71 
72 
73 #------------------------------------------------------------------------------
74 # Subdirectories
75 
76 #
77 # Subdirectories to Build
78 #
79 # The order is important. For example, if subdir1 builds an local executable
80 # needed by subdir3, then subdir1 must appear before subdir3 in the list.
81 #
82 RNMAKE_SUBDIRS = subdir1 \
83  subdir2 \
84  subdir3
85 
86 
87 #------------------------------------------------------------------------------
88 # Libraries
89 
90 #
91 # Distribution Static Libraries
92 #
93 # List of distribution static library tags to make. Distribution components get
94 # (cross) installed on the system.
95 #
96 # Format: <tag> ...
97 # where the fully qualified <tag> depends on the architecture, but
98 # typically gets converted to lib<tag>.a
99 #
100 # Note: A library tag can be listed in both the static and shared library tag
101 # list. In this case, both versions are built.
102 #
103 RNMAKE_DIST_STLIBS = mylib1 mylib2
104 
105 #
106 # Distribution Shared Libraries
107 #
108 # List of distribution shared library tags to make. Distribution components get
109 # (cross) installed on the system.
110 #
111 # Format: <tag> ...
112 # where the fully qualified <tag> depends on the architecture, but
113 # typically gets converted to lib<tag>.so
114 #
115 # Note: A library tag can be listed in both the static and shared library tag
116 # list. In this case, both versions are built.
117 #
118 RNMAKE_DIST_SHLIBS = mylib1
119 
120 #
121 # Local Static Libraries (i.e. not in distribution)
122 #
123 # List of local static library tags to make. Local components get built, but
124 # not installed. Local components are place under the directory $(topdir)/loc/.
125 #
126 # Format: <tag> ...
127 # where the fully qualified <tag> depends on the architecture, but
128 # typically gets converted to lib<tag>.a
129 #
130 # Example:
131 # A set of common files, say in $(topdir)/common, used by various other
132 # package components. By building $(topdir)/loc/lib/libcommon.a, other
133 # programs, etc and used the common files.
134 #
135 # Note: Local Shared Libraries are not allowed since installed package
136 # commponents would require the shared library.
137 #
138 RNMAKE_LOC_STLIBS = myloclib1
139 
140 
141 #------------------------------------------------------------------------------
142 # Programs
143 
144 RNMAKE_DIST_PGMS = pgm1
145 
146 #
147 # Local Program Executables (i.e. not in distribution)
148 #
149 # List of local program executable tags to make. Local components get built, but
150 # not installed. Local components are place under the directory $(topdir)/loc/.
151 #
152 # Format: <tag> ...
153 # where the fully qualified <tag> depends on the architecture, but
154 # typically gets converted to <tag> for linux, <tag>.exe for windows.
155 #
156 # Example:
157 # A tool hoehoehoe is used by other package components to complete the
158 # install process.
159 #
160 RNMAKE_LOC_PGMS = hoehoehoe
161 
162 # Libraries to Link With
163 pgm1.LIBS = pthread rnr
164 
165 # Library Dependencies
166 pgm1.LIBDEPS = rnr
167 
168 
169 #------------------------------------------------------------------------------
170 # Sources
171 
172 #
173 # C Source Files
174 #
175 # Source files for libraries and programs.
176 #
177 # Format: <tag>.SRC.C
178 # where <tag> is an item from one of the DIST_<x> tag lists for
179 # libraries and programs.
180 #
181 mylib1.SRC.C = o.c say.c can.c u.c c.c
182 
183 #
184 # C++ Source Files
185 #
186 # Source files for libraries and programs.
187 #
188 # Format: <tag>.SRC.CXX
189 # where <tag> is an item from one of the DIST_<x> tag lists for
190 # libraries and programs.
191 #
192 mylib2.SRC.CXX = file3.cxx file4.cxx
193 
194 # Local library example
195 myloclib1.SRC.C = locfile1.c
196 
197 # Program example
198 pgm1.SRC.C = lions.c tigers.c and.c bears.c
199 
200 # Local program example
201 pgm2.SRC.C = what.c a.c joke.c
202 
203 
204 #------------------------------------------------------------------------------
205 # Target Special
206 
207 # Define this...
208 TGT_SPECIAL = lookatme
209 
210 # ...to have Rules.mk call this on make [all]
211 lookatme:
212  @echo "I am so cool"
213 
214 # Define this...
215 TGT_INS_SPECIAL = nohands
216 
217 # ...to have Rules.mk call this on make install
218 nohands:
219 
220 
221 #------------------------------------------------------------------------------
222 # Optional Variables
223 #
224 
225 #
226 # Sub[Package] Language (used to facilitate linking)
227 #
228 # One of: "C" "C++"
229 #
230 # Default is "C"
231 #
232 LANG = "C"
233 
234 # Sub[Package] Extra Include Directories
235 EXTRA_INCDIRS = /myenv/include /yourenv/include
236 
237 # Sub[Package] Extra System Include Directories
238 EXTRA_SYS_INCDIRS =
239 
240 # Sub[Package] Extra C PreProcessor Flags
241 EXTRA_CPPFLAGS =
242 
243 # Sub[Package] Extra C Flags
244 EXTRA_CFLAGS =
245 
246 # Sub[Package] Extra CXX Flags
247 EXTRA_CXXFLAGS =
248 
249 # Sub[Package] Extra Library Paths (-L<path> ...)
250 EXTRA_LD_LIBDIRS = /myenv/lib
251 
252 # Sub[Package] Extra External Libraries
253 EXTRA_LD_LIBS = -lmylib
254 
255 # Sub[Package] Extra Link Flags
256 EXTRA_LDFLAGS =
257 
258 # Sub[Package] Extra Release Files (docs)
259 EXTRA_REL_FILES =
260 
261 # Sub[Package] extra 'all' default target
262 EXTRA_TGT_ALL = mything
263 
264 # Sub[Package] extra 'intall' target
265 EXTRA_TGT_INSTALL = yourthing
266 
267 #
268 # Document SubPackage Name
269 #
270 # Optional document subdirectory where [sub]package documentation will be
271 # placed.
272 #
273 # Installed location: $(docdir)/$(RNMAKE_PKG_FULL_NAME)/$(DOC_SUBDIR)
274 #
275 # Example: /usr/share/doc/pkg-1.3.0/mydocdir/
276 #
277 DOC_SUBDIR =
278 
279 # Sub[Package] Doxygen Configuration File
280 RNMAKE_DOXY_CONF_FILE = $(topdir)/make/doxy-mypgm.conf
281 
282 #------------------------------------------------------------------------------
283 # The RNMake Rules
284 #
285 
286 # Include Rules Makefile
287 include $(rnmake)/Rules.mk
288 
289 
290 #------------------------------------------------------------------------------
291 # Extra Targets (after Rules.mk)
292 #
293 
294 mything:
295  @echo "do my default thing"
296 
297 
298 yourthing:
299  @echo "do your intall thing"