Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vlad Doc
SRB2
Commits
dc02339c
Commit
dc02339c
authored
2 years ago
by
Eidolon
Browse files
Options
Downloads
Plain Diff
Merge branch 'comptime-no-fail' into 'master'
Minor comptime refactoring. See merge request
STJr/SRB2!1776
parents
c008dc4d
b7711b2b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
comptime.sh
+22
-32
22 additions, 32 deletions
comptime.sh
src/Makefile
+2
-2
2 additions, 2 deletions
src/Makefile
with
24 additions
and
34 deletions
comptime.sh
+
22
−
32
View file @
dc02339c
#!/bin/
bash -e
#!/bin/
sh
path
=
"."
if
[
x
"
$1
"
!=
x
]
;
then
path
=
"
$1
"
fi
versiongit
()
{
gitbranch
=
`
git rev-parse
--abbrev-ref
HEAD
`
gitversion
=
`
git rev-parse HEAD
`
cat
<<
EOF
>
$path
/comptime.h
version
()
{
cat
<<
EOF
> "
$path
/comptime.h"
// Do not edit! This file was autogenerated
// by the
$0
script with git
//
const char* compbranch = "
$
gitbranch
";
const char* comprevision = "
$
{
gitversion
:0:8
}
";
const char* compbranch = "
$
1
";
const char* comprevision = "
$
2
";
EOF
exit
0
}
versionsvn
()
{
svnrevision
=
`
svnversion
-n
$1
`
cat
<<
EOF
>
$path
/comptime.h
versiongit
()
{
gitbranch
=
"
$(
git rev-parse
--abbrev-ref
HEAD
)
"
gitversion
=
"
$(
git rev-parse HEAD |
cut
-c
-8
)
"
version
"
$gitbranch
"
"
$gitversion
"
;
exit
0
}
// Do not edit! This file was autogenerated
// by the
$0
script with subversion
//
const char* compbranch = "Subversion";
const char* comprevision = "r
$svnrevision
";
EOF
exit
0
versionsvn
()
{
svnrevision
=
"
$(
svnversion
-n
"
$1
"
)
"
version
"Subversion"
"r
$svnrevision
"
;
exit
0
}
versionfake
()
{
cat
<<
EOF
>
$path
/comptime.h
// Do not edit! This file was autogenerated
// by the
$0
script with an unknown or nonexist SCM
//
const char* compbranch = "Unknown";
const char* comprevision = "illegal";
EOF
version
"Unknown"
"illegal"
;
}
compversion
()
{
touch
$path
/comptime.c
versionfake
test
-d
$path
/.svn
&&
versionsvn
test
-d
$path
/../.git
&&
versiongit
exit
1
touch
"
$path
/comptime.c
"
versionfake
[
-d
"
$path
/.svn
"
]
&&
versionsvn
"
$@
"
[
-d
"
$path
/../.git
"
]
&&
versiongit
exit
1
}
test
-f
$path
/comptime.c
&&
compversion
[
-f
"
$path
/comptime.c
"
]
&&
compversion
"
$@
"
exit
2
This diff is collapsed.
Click to expand it.
src/Makefile
+
2
−
2
View file @
dc02339c
...
...
@@ -357,9 +357,9 @@ $(dbg).txt : $(dbg)
# this really updates comptime.h
comptime.c
::
ifdef
WINDOWSHELL
$(
.
)
..
\c
omptime.bat .
-
$(
.
)
..
\c
omptime.bat .
else
$(
.
)
../comptime.sh .
-
$(
.
)
../comptime.sh .
endif
# I wish I could make dependencies out of rc files :(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment