Skip to content

Commit

Permalink
Updated makefile to make stat command OS agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshdhgd committed Sep 24, 2024
1 parent 563cecd commit d133577
Show file tree
Hide file tree
Showing 2 changed files with 287,749 additions and 320,513 deletions.
9 changes: 8 additions & 1 deletion kg-microbe.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ REPO_URL := https://github.com/$(REPO_OWNER)/$(REPO_NAME)
TOKEN := $(GH_TOKEN)
MERGED_TARBALL := data_merged.tar.gz
PART_SIZE := 2000M # Size of each part (less than 2GB)
# Detect OS and set STAT_CMD accordingly
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
STAT_CMD = stat -c %s
else ifeq ($(UNAME_S),Darwin)
STAT_CMD = stat -f %z
endif

.PHONY: release pre-release tag generate-tarballs check-and-split

Expand Down Expand Up @@ -45,7 +52,7 @@ generate-tarballs:

check-and-split:
@echo "Checking if $(TARFILE) needs to be split..."
@if [ $$(stat -f%z "$(TARFILE)") -gt 2147483648 ]; then \
@if [ $$($(STAT_CMD) "$(TARFILE)") -gt 2147483648 ]; then \
echo "$(TARFILE) is larger than 2GB. Tarballing individual files..."; \
dirname=$$(basename $(DIR)); \
for file in $(DIR)/*; do \
Expand Down
Loading

0 comments on commit d133577

Please sign in to comment.