-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
120 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,7 @@ | ||
# DannyNiu/NJF, 2023-03-18. Public Domain. | ||
|
||
LibraryName = MySuiteA | ||
ProductName = lib${LibraryName} | ||
MajorVer = 0 | ||
MinorVer = 2 | ||
ProductVer = ${MajorVer}.${MinorVer} | ||
ProductRev = ${ProductVer}.1 | ||
|
||
FILE_EXT_ELF = so.${ProductVer} | ||
FILE_EXT_MACHO = ${ProductVer}.dylib | ||
|
||
FILE_EXT = ${FILE_EXT_MACHO} | ||
|
||
CFLAGS = -Wall -Wextra -fPIC # If I guessed wrong, specify on command line. | ||
LD = ${CC} # 2024-03-09: direct linker invocation lacks some default flags. | ||
|
||
# ``-G'' is the System V and XPG-8/SUSv5 option for producing | ||
# dynamic-linking library. Will need adaptation for pre-existing linkers. | ||
DLLFLAGS = -G | ||
|
||
OBJS_GROUP_WITH_ADDITIONAL = | ||
CFLAGS_GROUP_WITH = | ||
|
||
INPUT_OBJECTS = ${OBJS_GROUP_ALL} ${OBJS_GROUP_WITH_ADDITIONAL} | ||
|
||
prefix = /usr/local | ||
exec_prefix = ${prefix} | ||
libdir = ${exec_prefix}/lib | ||
includedir = ${prefix}/include | ||
|
||
include inc-config.mk | ||
include objects.mk | ||
|
||
# 2022-12-30: | ||
# Each product consist of: | ||
# - Name - obviously, | ||
# - Versioning - semver, *.so.{ver} on ELF, *.{ver}.dylib on Mach-O | ||
# MySuiteA is best used from source code directly; not everyone use | ||
# every algorithm implemented in the suite | ||
# DannyNiu/NJF, 2023-07-27. Public Domain. | ||
|
||
.PHONY: all install uninstall clean distclean | ||
|
||
all: build/${ProductName}.${FILE_EXT} build/include build/${ProductName}.pc | ||
|
||
install: | ||
mkdir -p ${libdir}/pkgconfig ${includedir} | ||
cp build/"${ProductName}".pc ${libdir}/pkgconfig | ||
cp build/"${ProductName}.${FILE_EXT}" ${libdir} | ||
if [ -e ${includedir}/MySuiteA ] ; then \ | ||
echo include headers director exists! ; \ | ||
false ; \ | ||
else cp -R -L build/include ${includedir}/MySuiteA ; fi | ||
|
||
uninstall: | ||
rm ${libdir}/pkgconfig/"${ProductName}".pc | ||
rm ${libdir}/"${ProductName}.${FILE_EXT}" | ||
rm -R ${includedir}/MySuiteA | ||
|
||
clean: | ||
rm -f build/"${ProductName}.${FILE_EXT}" | ||
rm -f build/"${ProductName}.pc" | ||
rm -Rf build/include | ||
rm -f ${OBJS_GROUP_ALL} ${OBJS_GROUP_WITH_ADDITIONAL} | ||
|
||
distclean: clean | ||
rm -f inc-config.mk auto/configure[-.]* | ||
|
||
build/${ProductName}.${FILE_EXT}: ${INPUT_OBJECTS} | ||
${LD} ${DLLFLAGS} ${LDFLAGS} ${INPUT_OBJECTS} -o $@ | ||
|
||
build/include: | ||
mkdir -p build/include | ||
cd src ; find . -name \*.h ! -name \*.c.h ! -name \*largeint\* | \ | ||
while read e ; do \ | ||
mkdir -p "../build/include/$$(dirname "$$e")" ; \ | ||
ln -s "$$PWD/$$e" "../build/include/$$e" ; \ | ||
done | ||
|
||
build/${ProductName}.pc: | ||
printf '%s\n' \ | ||
"prefix=${prefix}" "exec_prefix=${exec_prefix}" \ | ||
"libdir=${libdir}" "includedir=${includedir}" \ | ||
"Name: MySuiteA Dynamic Library" \ | ||
"Version: ${ProductRev}" \ | ||
"Description: The MySuiteA Cryptography Library." \ | ||
"URL: https://github.com/dannyniu/MySuiteA" \ | ||
"URL: https://gitee.com/dannyniu/MySuiteA" \ | ||
'Cflags: -I$${includedir} '"${CFLAGS_GROUP_WITH}" \ | ||
'Libs: -L$${libdir} -lMySuiteA' \ | ||
> $@ | ||
|
||
# 2024-03-08: | ||
# This file is created whenever "inc-dep.mk" ought to be re-made for | ||
# inclusion, and is asynchronously removed after about 3 seconds. | ||
auto/meta-phony.tmp: | ||
date -u "+%Y-%m-%d T %T %Z" > auto/meta-phony.tmp | ||
|
||
inc-dep.mk: auto/meta-phony.tmp | ||
utils/gen-inc-dep.sh src > inc-dep.mk | ||
{ sleep 3 ; rm auto/meta-phony.tmp ; } & | ||
|
||
# 2024-03-08: | ||
# the include file contains target rules, so it | ||
# must not come before the first rule of this file. | ||
include inc-dep.mk | ||
all:; ${MAKE} -f build.mk ${MAKEFLAGS} $@ | ||
install uninstall clean distclean: | ||
${MAKE} -f housekeeping.mk ${MAKEFLAGS} $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# DannyNiu/NJF, 2024-07-27. Public Domain. | ||
|
||
include common.mk | ||
|
||
include inc-config.mk | ||
include objects.mk | ||
|
||
.PHONY: all | ||
|
||
all: build/${ProductName}.${FILE_EXT} build/include build/${ProductName}.pc | ||
|
||
build/${ProductName}.${FILE_EXT}: ${INPUT_OBJECTS} | ||
${LD} ${DLLFLAGS} ${LDFLAGS} ${INPUT_OBJECTS} -o $@ | ||
|
||
build/include: | ||
mkdir -p build/include | ||
cd src ; find . -name \*.h ! -name \*.c.h ! -name \*largeint\* | \ | ||
while read e ; do \ | ||
mkdir -p "../build/include/$$(dirname "$$e")" ; \ | ||
cp "$$PWD/$$e" "../build/include/$$e" ; \ | ||
done | ||
|
||
build/${ProductName}.pc: | ||
printf '%s\n' \ | ||
"prefix=${prefix}" "exec_prefix=${exec_prefix}" \ | ||
"libdir=${libdir}" "includedir=${includedir}" \ | ||
"Name: MySuiteA Dynamic Library" \ | ||
"Version: ${ProductRev}" \ | ||
"Description: The MySuiteA Cryptography Library." \ | ||
"URL: https://github.com/dannyniu/MySuiteA" \ | ||
"URL: https://gitee.com/dannyniu/MySuiteA" \ | ||
'Cflags: -I$${includedir} '"${CFLAGS_GROUP_WITH}" \ | ||
'Libs: -L$${libdir} -lMySuiteA' \ | ||
> $@ | ||
|
||
# 2024-03-08: | ||
# This file is created whenever "inc-dep.mk" ought to be re-made for | ||
# inclusion, and is asynchronously removed after about 3 seconds. | ||
auto/meta-phony.tmp: | ||
date -u "+%Y-%m-%d T %T %Z" > auto/meta-phony.tmp | ||
|
||
inc-dep.mk: auto/meta-phony.tmp | ||
utils/gen-inc-dep.sh src > inc-dep.mk | ||
{ sleep 3 ; rm auto/meta-phony.tmp ; } & | ||
|
||
# 2024-03-08: | ||
# the include file contains target rules, so it | ||
# must not come before the first rule of this file. | ||
include inc-dep.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# DannyNiu/NJF, 2024-07-27. Public Domain. | ||
|
||
LibraryName = MySuiteA | ||
ProductName = lib${LibraryName} | ||
MajorVer = 0 | ||
MinorVer = 2 | ||
ProductVer = ${MajorVer}.${MinorVer} | ||
ProductRev = ${ProductVer}.1 | ||
|
||
FILE_EXT_ELF = so.${ProductVer} | ||
FILE_EXT_MACHO = ${ProductVer}.dylib | ||
|
||
FILE_EXT = ${FILE_EXT_MACHO} | ||
|
||
CFLAGS = -Wall -Wextra -fPIC # If I guessed wrong, specify on command line. | ||
LD = ${CC} # 2024-03-09: direct linker invocation lacks some default flags. | ||
|
||
# ``-G'' is the System V and XPG-8/SUSv5 option for producing | ||
# dynamic-linking library. Will need adaptation for pre-existing linkers. | ||
DLLFLAGS = -G | ||
|
||
OBJS_GROUP_WITH_ADDITIONAL = | ||
CFLAGS_GROUP_WITH = | ||
|
||
INPUT_OBJECTS = ${OBJS_GROUP_ALL} ${OBJS_GROUP_WITH_ADDITIONAL} | ||
|
||
prefix = /usr/local | ||
exec_prefix = ${prefix} | ||
libdir = ${exec_prefix}/lib | ||
includedir = ${prefix}/include | ||
|
||
# 2022-12-30: | ||
# Each product consist of: | ||
# - Name - obviously, | ||
# - Versioning - semver, *.so.{ver} on ELF, *.{ver}.dylib on Mach-O | ||
# MySuiteA is best used from source code directly; not everyone use | ||
# every algorithm implemented in the suite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# DannyNiu/NJF, 2024-07-27. Public Domain. | ||
|
||
include common.mk | ||
|
||
.PHONY: all install uninstall clean distclean | ||
|
||
all:;: | ||
|
||
install: | ||
mkdir -p ${libdir}/pkgconfig ${includedir} | ||
cp build/"${ProductName}".pc ${libdir}/pkgconfig | ||
cp build/"${ProductName}.${FILE_EXT}" ${libdir} | ||
if [ -e ${includedir}/MySuiteA ] ; then \ | ||
echo include headers director exists! ; \ | ||
false ; \ | ||
else cp -R -L build/include ${includedir}/MySuiteA ; fi | ||
|
||
uninstall: | ||
rm ${libdir}/pkgconfig/"${ProductName}".pc | ||
rm ${libdir}/"${ProductName}.${FILE_EXT}" | ||
rm -R ${includedir}/MySuiteA | ||
|
||
clean: | ||
rm -f build/"${ProductName}.${FILE_EXT}" | ||
rm -f build/"${ProductName}.pc" | ||
rm -Rf build/include | ||
rm -f ${OBJS_GROUP_ALL} ${OBJS_GROUP_WITH_ADDITIONAL} | ||
|
||
distclean: clean | ||
rm -f inc-*.mk auto/configure[-.]* |