Skip to content

Commit 944f002

Browse files
committedMar 25, 2025·
make - ci doesn't always have perm to write files
1 parent 428c7f6 commit 944f002

File tree

3 files changed

+61
-52
lines changed

3 files changed

+61
-52
lines changed
 

‎Makefile

+5-17
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ endif
665665
# when creating shared or static libraries.
666666
weak_last = $(filter-out %-weak.o,$(1)) $(filter %-weak.o,$(1))
667667

668-
libceed.o = $(libceed.c:%.c=$(OBJDIR)/%.o) $(OBJDIR)/interface/ceed-config.o $(libceed.cpp:%.cpp=$(OBJDIR)/%.o) $(libceed.cu:%.cu=$(OBJDIR)/%.o) $(libceed.hip:%.hip.cpp=$(OBJDIR)/%.o) $(libceed.sycl:%.sycl.cpp=$(OBJDIR)/%.o)
668+
libceed.o = $(libceed.c:%.c=$(OBJDIR)/%.o) $(libceed.cpp:%.cpp=$(OBJDIR)/%.o) $(libceed.cu:%.cu=$(OBJDIR)/%.o) $(libceed.hip:%.hip.cpp=$(OBJDIR)/%.o) $(libceed.sycl:%.sycl.cpp=$(OBJDIR)/%.o)
669669
$(filter %fortran.o,$(libceed.o)) : CPPFLAGS += $(if $(filter 1,$(UNDERSCORE)),-DUNDERSCORE)
670670
$(libceed.o): | info-backends
671671
$(libceed.so) : $(call weak_last,$(libceed.o)) | $$(@D)/.DIR
@@ -675,10 +675,7 @@ $(libceed.a) : $(call weak_last,$(libceed.o)) | $$(@D)/.DIR
675675
$(call quiet,AR) $(ARFLAGS) $@ $^
676676

677677
$(OBJDIR)/%.o : $(CURDIR)/%.c | $$(@D)/.DIR
678-
$(call quiet,CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(abspath $<)
679-
680-
$(OBJDIR)/%.o : $(OBJDIR)/%.c | $$(@D)/.DIR # source files generated in OBJDIR
681-
$(call quiet,CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(abspath $<)
678+
$(call quiet,CC) $(CPPFLAGS) $(CFLAGS) $(CONFIGFLAGS) -c -o $@ $(abspath $<)
682679

683680
$(OBJDIR)/%.o : $(CURDIR)/%.cpp | $$(@D)/.DIR
684681
$(call quiet,CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(abspath $<)
@@ -857,18 +854,9 @@ $(OBJDIR)/ceed.pc : pkgconfig-prefix = $(prefix)
857854

858855
GIT_DESCRIBE = $(shell git describe --always --dirty 2>/dev/null || printf "unknown\n")
859856

860-
$(OBJDIR)/interface/ceed-config.c: Makefile
861-
@printf '#include <ceed-impl.h>\n\n' > $@
862-
@printf 'int CeedGetGitVersion(const char **git_version) {\n' >> $@
863-
@printf ' *git_version = "$(GIT_DESCRIBE)";\n' >> $@
864-
@printf ' return 0;\n' >> $@
865-
@printf '}\n\n' >> $@
866-
@printf 'int CeedGetBuildConfiguration(const char **build_config) {\n' >> $@
867-
@printf ' *build_config =' >> $@
868-
@printf "$(foreach v,$(CONFIG_VARS),\n\"$(v) = $($(v))\\\n\")\n" >> $@
869-
@printf ';\n' >> $@
870-
@printf ' return 0;\n' >> $@
871-
@printf '}\n' >> $@
857+
$(OBJDIR)/interface/ceed-config.o: Makefile
858+
$(OBJDIR)/interface/ceed-config.o: CONFIGFLAGS += -DCEED_GIT_VERSION="\"$(GIT_DESCRIBE)\""
859+
$(OBJDIR)/interface/ceed-config.o: CONFIGFLAGS += -DCEED_BUILD_CONFIGURATION="\"// Build Configuration:$(foreach v,$(CONFIG_VARS),\n$(v) = $($(v)))\""
872860

873861
$(OBJDIR)/interface/ceed-jit-source-root-default.o : CPPFLAGS += -DCEED_JIT_SOURCE_ROOT_DEFAULT="\"$(abspath ./include)/\""
874862
$(OBJDIR)/interface/ceed-jit-source-root-install.o : CPPFLAGS += -DCEED_JIT_SOURCE_ROOT_DEFAULT="\"$(abspath $(includedir))/\""

‎interface/ceed-config.c

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and other CEED contributors.
2+
// All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3+
//
4+
// SPDX-License-Identifier: BSD-2-Clause
5+
//
6+
// This file is part of CEED: http://github.com/ceed
7+
8+
#include <ceed-impl.h>
9+
10+
const char *CeedGitVersion = CEED_GIT_VERSION;
11+
const char *CeedBuildConfiguration = CEED_BUILD_CONFIGURATION;
12+
13+
/// @addtogroup CeedUser
14+
/// @{
15+
16+
/**
17+
@brief Get output of `git describe --dirty` from build time
18+
19+
While @ref CeedGetVersion() uniqely identifies the source code for release
20+
builds, it does not identify builds from other commits.
21+
22+
@param[out] git_version A static string containing the Git commit description.
23+
24+
If `git describe --always --dirty` fails, the string `"unknown"` will be provided.
25+
This could occur if Git is not installed or if libCEED is not being built from a repository, for example.`
26+
27+
@return An error code: 0 - success, otherwise - failure
28+
29+
@ref Developer
30+
31+
@sa CeedGetVersion() CeedGetBuildConfiguration()
32+
*/
33+
int CeedGetGitVersion(const char **git_version) {
34+
*git_version = CeedGitVersion;
35+
return CEED_ERROR_SUCCESS;
36+
}
37+
38+
/**
39+
@brief Get build variables as a multi-line string
40+
41+
Each line of the string has the format `VARNAME = value`.
42+
43+
@param[out] build_config A static string containing build variables
44+
45+
@return An error code: 0 - success, otherwise - failure
46+
47+
@ref Developer
48+
49+
@sa CeedGetVersion() CeedGetGitVersion()
50+
*/
51+
int CeedGetBuildConfiguration(const char **build_config) {
52+
*build_config = CeedBuildConfiguration;
53+
return CEED_ERROR_SUCCESS;
54+
}
55+
56+
/// @}

‎interface/ceed.c

-35
Original file line numberDiff line numberDiff line change
@@ -1682,41 +1682,6 @@ int CeedGetVersion(int *major, int *minor, int *patch, bool *release) {
16821682
return CEED_ERROR_SUCCESS;
16831683
}
16841684

1685-
/**
1686-
@brief Get output of `git describe --dirty` from build time
1687-
1688-
While @ref CeedGetVersion() uniqely identifies the source code for release
1689-
builds, it does not identify builds from other commits.
1690-
1691-
@param[out] git_version A static string containing the Git commit description.
1692-
1693-
If `git describe --dirty` fails, the string `"unknown"` will be provided. This
1694-
could occur if Git is not installed or if libCEED is not being built from a
1695-
repository, for example.`
1696-
1697-
@return An error code: 0 - success, otherwise - failure
1698-
1699-
@ref Developer
1700-
1701-
@sa CeedGetVersion() CeedGetBuildConfiguration()
1702-
*/
1703-
int CeedGetGitVersion(const char **git_version); // defined in generated ceed-config.h
1704-
1705-
/**
1706-
@brief Get build variables as a multi-line string
1707-
1708-
Each line of the string has the format `VARNAME = value`.
1709-
1710-
@param[out] build_config A static string containing build variables
1711-
1712-
@return An error code: 0 - success, otherwise - failure
1713-
1714-
@ref Developer
1715-
1716-
@sa CeedGetVersion() CeedGetGitVersion()
1717-
*/
1718-
int CeedGetBuildConfiguration(const char **build_config); // defined in generated ceed-config.h
1719-
17201685
/**
17211686
@brief Get libCEED scalar type, such as F64 or F32
17221687

0 commit comments

Comments
 (0)
Please sign in to comment.