Files
mstore/Makefile.am
T
2026-02-20 14:08:47 +02:00

258 lines
6.5 KiB
Makefile

AUTOMAKE_OPTIONS = foreign no-dependencies no-installinfo
GOFLAGS= -v
bin_PROGRAMS = mstorectl
sbin_PROGRAMS = mstored
mstorectl_SOURCES = \
cmd/mstorectl/filecmd.go \
cmd/mstorectl/imagecmd.go \
cmd/mstorectl/accountcmd.go \
cmd/mstorectl/grantcmd.go \
cmd/mstorectl/main.go
mstored_SOURCES = \
cmd/mstored/main.go
mstorectl$(EXEEXT): $(mstorectl_SOURCES) $(EXTRA_mstored_SOURCES)
env CGO_ENABLED=0 $(GO) build $(GOFLAGS) -o mstorectl$(EXEEXT) $(mstorectl_SOURCES)
mstored$(EXEEXT): $(mstored_SOURCES) $(EXTRA_mstored_SOURCES)
env CGO_ENABLED=1 $(GO) build $(GOFLAGS) -o mstored$(EXEEXT) $(mstored_SOURCES)
run: $(mstored_SOURCES)
cd cmd/mstored && env CGO_ENABLED=1 $(GO) run . -daemon=false
CWD=$(shell pwd)
EXTRA_mstored_SOURCES = \
app/config/config.go \
app/config/variant.go \
\
pkg/descr/account.go \
pkg/descr/blob.go \
pkg/descr/file.go \
pkg/descr/grant.go \
pkg/descr/manifest.go \
pkg/descr/response.go \
pkg/descr/server.go \
\
app/handler/aaafunc.go \
app/handler/account.go \
app/handler/blob.go \
app/handler/file.go \
app/handler/grant.go \
app/handler/handler.go \
app/handler/manifest.go \
app/handler/notfound.go \
app/handler/response.go \
app/handler/service.go \
app/handler/version.go \
app/logger/logger.go \
\
app/maindb/account.go \
app/maindb/blob.go \
app/maindb/file.go \
app/maindb/grant.go \
app/maindb/init.go \
app/maindb/maindb.go \
app/maindb/manifest.go \
app/maindb/scheme.go \
\
app/operator/account.go \
app/operator/blob.go \
app/operator/file.go \
app/operator/grant.go \
app/operator/imgaux.go \
app/operator/manifest.go \
app/operator/ociaux.go \
app/operator/operator.go \
app/operator/service.go \
app/operator/version.go \
app/router/bindobj.go \
app/router/context.go \
app/router/corsmw.go \
app/router/loggingmw.go \
app/router/pathc.go \
app/router/recovermw.go \
app/router/router.go \
\
app/server/server.go \
app/service/service.go \
app/storage/storage.go \
\
pkg/auxhttp/basic.go \
pkg/auxhttp/crange.go \
pkg/auxoci/ociaux.go \
pkg/auxpwd/passwd.go \
pkg/auxtool/cleandir.go \
pkg/auxtool/fileex.go \
pkg/auxtool/randstr.go \
pkg/auxtool/tmpfile.go \
pkg/auxtool/unixnow.go \
pkg/auxutar/utar.go \
pkg/auxuuid/uuid.go \
pkg/auxx509/x509cert.go \
pkg/client/account.go \
pkg/client/client.go \
pkg/client/fileaux.go \
pkg/client/file.go \
pkg/client/grant.go \
pkg/client/httpcall.go \
pkg/client/imageaux.go \
pkg/client/imagedelete.go \
pkg/client/imageinfo.go \
pkg/client/imagepull.go \
pkg/client/imagepush.go \
pkg/client/service.go
EXTRA_DIST = vendor/ \
Containerfile \
go.mod \
go.sum \
LICENSE.txt \
README.md \
\
app/logger/logger_test.go \
app/maindb/file_test.go \
app/maindb/grant_test.go \
app/router/pathc_test.go \
app/router/router_test.go \
\
pkg/auxpwd/passwd_test.go \
pkg/auxx509/x509cert_test.go \
attic/account_test.go \
attic/file_test.go \
\
chart/Chart.yaml.in \
chart/.gitignore \
chart/.helmignore \
chart/templates/configmap.yaml \
chart/templates/deployment.yaml \
chart/templates/_imagepath.tpl \
chart/templates/_serviceport.tmpl \
chart/templates/service.yaml \
chart/templates/_storageclass.tpl \
chart/templates/_storagesize.tpl \
chart/templates/_userpass.tpl \
chart/templates/volumeclaim.yaml \
chart/values.yaml.in \
\
debian/changelog.in \
debian/compat \
debian/control.in \
debian/files \
debian/.gitignore \
debian/mstore-control.install \
debian/mstore-control.postinst \
debian/mstore-control.postrm \
debian/mstore-control.preinst \
debian/mstore-control.prerm \
debian/mstore-service.install \
debian/mstore-service.postinst \
debian/mstore-service.postrm \
debian/mstore-service.preinst \
debian/mstore-service.prerm \
debian/patches/series \
debian/README.Debian \
debian/rules \
debian/source/format \
debian/source/include-binaries \
debian/watch \
\
initrc/.gitignore \
initrc/mstored.in \
initrc/mstored.service.in \
\
test/account_test.go \
test/file_test.go \
test/image_test.go \
test/test-oci.tar
format:
@dirs=$$($(FIND) $(CWD) -name '*.go' | $(XARGS) -n1 dirname | $(SORT) | $(UNIQ)); \
for dir in $$dirs;do \
(echo "====$$dir===="; cd $$dir && $(GO) fmt .); \
done
.PHONY: test
test:
cd test && $(GO) test -v .
DIST_DIR= $(shell pwd)/DIST
BUILD_DIR= $(shell pwd)/BUILD
IMAGE_REPO = localhost
IMAGE_NAME = $(PACKAGE_NAME):$(PACKAGE_VERSION)
IMAGE_TARNAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION).img
IMAGE_CONTAINERFILE = Containerfile
image:: build-image
build-image: clean
# $(GO) mod vendor
mkdir -p $(DIST_DIR)
$(SUDO) $(PODMAN) build -t $(IMAGE_REPO)/$(IMAGE_NAME) -f $(IMAGE_CONTAINERFILE) .
rm -f $(DIST_DIR)/$(IMAGE_TARNAME)
$(SUDO) $(PODMAN) image save $(IMAGE_REPO)/$(IMAGE_NAME) --format oci-archive \
-o $(DIST_DIR)/$(IMAGE_TARNAME)
username=$$(whoami); \
$(SUDO) chown $$username $(DIST_DIR)/$(IMAGE_TARNAME)
# rm -rf vendor
CHART_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION).tgz
chart:: build-chart
build-chart:
mkdir -p $(DIST_DIR)
$(HELM) package --destination $(DIST_DIR) chart/
$(DIST_ARCHIVES): dist
package:: debian-package
debian-package: $(DIST_ARCHIVES)
mkdir -p $(BUILD_DIR)
mv $(DIST_ARCHIVES) $(BUILD_DIR)
cd $(BUILD_DIR) && $(AMTAR) -xf $(DIST_ARCHIVES)
cd $(BUILD_DIR)/$(distdir) && ./configure --prefix=/usr
cd $(BUILD_DIR)/$(distdir) && $(MAKE) clean
cd $(BUILD_DIR)/$(distdir) && $(DPKGSOURCE) -i --before-build .
cd $(BUILD_DIR)/$(distdir) && $(DBUILDPACKAGE) -nc -us -uc -ui -i -b
mkdir -p $(DIST_DIR)
$(CP) $(BUILD_DIR)/*.deb $(DIST_DIR)
rm -rf $(BUILD_DIR)
FREEBSD_LOCALBASE = /usr/local
FREEBSD_RCDIR = $(FREEBSD_LOCALBASE)/etc/rc.d
LINUX_SYSTEMDDIR = /lib/systemd/system
install-data-local:
test -z $(DESTDIR)$(srv_confdir) || $(MKDIR_P) $(DESTDIR)$(srv_confdir)
test -z $(DESTDIR)$(srv_logdir) || $(MKDIR_P) $(DESTDIR)$(srv_logdir)
test -z $(DESTDIR)$(srv_rundir) || $(MKDIR_P) $(DESTDIR)$(srv_rundir)
test -z $(DESTDIR)$(srv_datadir) || $(MKDIR_P) $(DESTDIR)$(srv_datadir)
if FREEBSD_OS
test -z $(DESTDIR)$(FREEBSD_RCDIR) || $(MKDIR_P) $(DESTDIR)$(FREEBSD_RCDIR)
$(INSTALL_DATA) initrc/mstored $(DESTDIR)$(FREEBSD_RCDIR)
chmod a+x $(DESTDIR)$(FREEBSD_RCDIR)/mstored
endif
if LINUX_OS
if SYSTEMD
test -z $(DESTDIR)$(LINUX_SYSTEMDDIR) || $(MKDIR_P) $(DESTDIR)$(LINUX_SYSTEMDDIR)
$(INSTALL_DATA) initrc/mstored.service $(DESTDIR)$(LINUX_SYSTEMDDIR)
endif
endif
clean-local:
$(FIND) $(CWD) -name '*~' | $(XARGS) rm -f
rm -rf autom4te.cache
rm -f cmd/mstored/istored
rm -f cmd/mstorectl/mstorectl
# rm -rf tmp/
distclean-local:
rm -rf autom4te.cache
rm -rf $(DIST_DIR)
rm -rf tmp/