8
8
##############################################################################
9
9
10
10
.PHONY : all prepare all-targets all-libs clean \
11
- version compile-tests install release dpkg
11
+ gitver version compile-tests install release dpkg
12
12
13
13
# You may have to change the following sets of macro definitions which will
14
14
# be used throughout the build makefile. These definitions cover the paths
@@ -132,11 +132,30 @@ endif
132
132
133
133
VERBOSE ?= @
134
134
135
+ ##########################################################################
136
+ # Set up version and date properties
137
+ ##########################################################################
138
+
139
+ DATEISO = $(shell date --iso=date)
140
+ DATESTR = $(shell date "+%d.%m.%Y")
141
+
142
+ # Parse the repo tag to different defines, that will be used while
143
+ # compiling clib4 library
144
+ #
145
+ # The tags should be like v(MAJOR).(MINOR).(PATCH)
146
+ # in example v1.2.3
147
+ #
148
+ ifneq ($(origin GITTAG),undefined)
149
+ MAJOR = $(patsubst v%,%,$(firstword $(subst ., ,$(GITTAG))))
150
+ MINOR = $(word 2, $(subst ., ,$(GITTAG)))
151
+ PATCH = $(word 3, $(subst ., ,$(GITTAG)))
152
+ endif
153
+
135
154
##############################################################################
136
155
137
156
# This is the first target: it depends on all the targets
138
157
139
- all: prepare all-targets all-libs clib4.library.debug clib4.library
158
+ all: gitver prepare all-targets all-libs clib4.library.debug clib4.library
140
159
141
160
##############################################################################
142
161
@@ -182,12 +201,12 @@ ALL_TARGETS = \
182
201
$(OUTPUT_LIB)/crtend.o \
183
202
$(OUTPUT_LIB)/shcrtbegin.o \
184
203
$(OUTPUT_LIB)/shcrtend.o \
185
- $(OUT_SHARED_LIB)/shared_library/clib4.o \
186
- $(OUT_SHARED_LIB)/shared_library/math.o \
204
+ $(OUT_SHARED_LIB)/shared_library/clib4.o \
205
+ $(OUT_SHARED_LIB)/shared_library/math.o \
187
206
$(MAIN_LIB)
188
207
189
208
ifdef SPE
190
- ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
209
+ ALL_TARGETS := PatchForSPE | $(ALL_TARGETS)
191
210
endif
192
211
193
212
all-targets: $(ALL_TARGETS)
@@ -213,6 +232,16 @@ clean:
213
232
214
233
##############################################################################
215
234
235
+ gitver:
236
+ $(VERBOSE)sed -i 's/[(]\([0-9]*\.[0-9]*\.[0-9]*\)[)]/($(DATESTR))/g' library/c.lib_rev.h
237
+ $(VERBOSE)sed -i 's/"\([0-9]*\.[0-9]*\.[0-9]*\)"/"$(DATESTR)"/g' library/c.lib_rev.h
238
+ ifdef GITTAG
239
+ $(VERBOSE)sed -i 's/VERSION\t*[[:digit:]]/VERSION\t\t\t$(MAJOR)/g' library/c.lib_rev.h
240
+ $(VERBOSE)sed -i 's/REVISION\t*[[:digit:]]/REVISION\t\t$(MINOR)/g' library/c.lib_rev.h
241
+ $(VERBOSE)sed -i 's/SUBREVISION\t*[[:digit:]]/SUBREVISION\t\t$(PATCH)/g' library/c.lib_rev.h
242
+ $(VERBOSE)sed -i 's/clib4.library [0-9]*\.[0-9]*\.[0-9]*/clib4.library $(MAJOR).$(MINOR).$(PATCH)/g' library/c.lib_rev.h
243
+ endif
244
+
216
245
# Update the version numbers bound to the individual libraries
217
246
version:
218
247
$(COPY) c.lib_rev.rev amiga/amiga.lib_rev.rev
0 commit comments