Skip to content

Commit

Permalink
Merge pull request PelicanPlatform#128 from CannonLock/make-update
Browse files Browse the repository at this point in the history
Makefile updates
  • Loading branch information
jhiemstrawisc authored Sep 14, 2023
2 parents ae12bfc + c86ab33 commit 38a0175
Showing 1 changed file with 46 additions and 39 deletions.
85 changes: 46 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@
# limitations under the License.
#

CONTAINER_TOOL := docker
USE_DOCKER=0

CONTAINER_TOOL=docker

ifeq ($(OS),Windows_NT)
goos := windows
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
goarch := arm64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
goarch := arm64
endif
endif
goos := windows
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
goarch := arm64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
goarch := arm64
endif
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
goos := linux
endif
ifeq ($(UNAME_S),Darwin)
goos := darwin
endif
UNAME_P := $(shell uname -p)
UNAME_M := $(shell uname -m)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
goos := linux
endif
ifeq ($(UNAME_S),Darwin)
goos := darwin
endif
UNAME_P := $(shell uname -p)
UNAME_M := $(shell uname -m)
ifneq ($(filter arm64%,$(UNAME_M)),)
goarch := arm64
endif
Expand All @@ -43,9 +45,20 @@ endif
WEBSITE_SRC_PATH := origin_ui/src
WEBSITE_OUT_PATH := origin_ui/src/out
WEBSITE_CACHE_PATH := origin_ui/src/.next
WEBSITE_SRC_FILES := $(shell find $(WEBSITE_SRC_PATH)/app -type f) \
$(shell find $(WEBSITE_SRC_PATH)/components -type f) \
$(shell find $(WEBSITE_SRC_PATH)/helpers -type f) \
$(shell find $(WEBSITE_SRC_PATH)/public -type f) \
origin_ui/src/tsconfig.json \
origin_ui/src/next.config.js \
origin_ui/src/package.json \
origin_ui/src/package-lock.json \
origin_ui/src/Dockerfile

WEBSITE_OUT_FILE := $(WEBSITE_OUT_FILES)/index.html

WEBSITE_CLEAN_LIST := $(WEBSITE_OUT_PATH) \
$(WEBSITE_CACHE_PATH)
$(WEBSITE_CACHE_PATH)


.PHONY: all
Expand All @@ -57,20 +70,21 @@ web-clean:
@rm -rf $(WEBSITE_CLEAN_LIST)

.PHONY: web-build
web-build:
web-build: origin_ui/src/out/index.html
origin_ui/src/out/index.html : $(WEBSITE_SRC_FILES)
ifeq ($(USE_DOCKER),0)
@cd $(WEBSITE_SRC_PATH) && npm install && npm run build
else
@cd $(WEBSITE_SRC_PATH) && $(CONTAINER_TOOL) build -t origin-ui . && $(CONTAINER_TOOL) run --rm -v `pwd`:/webapp origin-ui npm run build
endif

.PHONY: web-serve
web-serve:
ifeq ($(USE_DOCKER),0)
@cd $(WEBSITE_SRC_PATH) && npm install && npm run dev

.PHONY: web-docker-build
web-docker-build:
cd $(WEBSITE_SRC_PATH) && $(CONTAINER_TOOL) build -t origin-ui . && $(CONTAINER_TOOL) run --rm -v `pwd`:/webapp -it origin-ui npm install && npm run build

.PHONE: web-docker-serve
web-docker-serve:
@cd $(WEBSITE_SRC_PATH) && $(CONTAINER_TOOL) build -t origin-ui . && $(CONTAINER_TOOL) run --rm -v `pwd`:/webapp -p 3000:3000 -it origin-ui npm install && npm run dev
else
@cd $(WEBSITE_SRC_PATH) && $(CONTAINER_TOOL) build -t origin-ui . && $(CONTAINER_TOOL) run --rm -v `pwd`:/webapp -p 3000:3000 origin-ui npm run dev
endif


PELICAN_DIST_PATH := dist
Expand All @@ -81,26 +95,19 @@ pelican-clean:
@rm -rf $(PELICAN_DIST_PATH)

.PHONY: pelican-build
pelican-build: web-build
pelican-build: origin_ui/src/out/index.html
@echo PELICAN BUILD
ifeq ($(USE_DOCKER),0)
@goreleaser --clean --snapshot

# This take awhile to run due to the file mount
.PHONY: pelican-docker-build
pelican-docker-build: web-docker-build
@echo PELICAN BUILD
else
@$(CONTAINER_TOOL) run -w /app -v $(PWD):/app goreleaser/goreleaser --clean --snapshot
endif

.PHONY: pelican-serve-test-origin
pelican-serve-test-origin: pelican-build
@echo SERVE TEST ORIGIN
@cd $(PELICAN_DIST_PATH)/pelican_$(goos)_$(goarch) && cp pelican osdf && ./osdf origin serve -f https://osg-htc.org -v /tmp/stash/:/test

.PHONY: pelican-docker-serve-test-origin
pelican-docker-serve-test-origin:
@echo SERVE TEST ORIGIN
@$(CONTAINER_TOOL) run --rm -v `pwd`:/webapp -v /tmp/stash:/test -it pelican-server ./osdf-client origin serve -f https://osg-htc.org -v /test

.PHONY: pelican-build-server-image
pelican-build-server-image:
@echo BUILD SERVER IMAGE
Expand Down

0 comments on commit 38a0175

Please sign in to comment.