Skip to content

Commit

Permalink
Use "Smalltalk makefiles"
Browse files Browse the repository at this point in the history
  • Loading branch information
janvrany authored and shingarov committed Jun 8, 2023
1 parent d5890c0 commit 7d5af2c
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 214 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "makefiles"]
path = makefiles
url = https://github.com/janvrany/smalltalk-makefiles.git
1 change: 1 addition & 0 deletions makefiles
Submodule makefiles added at 998ca2
83 changes: 0 additions & 83 deletions pharo.gmk

This file was deleted.

72 changes: 30 additions & 42 deletions pharo/GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,64 +1,52 @@
PROJECT=ArchC

include GNUmakefile.local
all: build

# Pharo version to use. Currently, only 8.0 is supported,
# Pharo 9.0 and later is known to crash when using Z3.
PHARO_VERSION ?= 80
../makefiles/%.gmk:
git submodule update --init --recursive $(dir $@)

all: $(PROJECT).image
-include GNUmakefile.local
include ../makefiles/pharo.gmk
include ../makefiles/git.gmk

ifndef ARCHC_PDL_DIR
ARCHC_PDL_DIR=../pdl

../pdl:
(cd .. && ./get-pdls.sh)
ifndef MACHINEARITHMETIC_DIR
MACHINEARITHMETIC_DIR := ../3rdparty/MachineArithmetic
MACHINEARITHMETIC_URL ?= https://github.com/shingarov/MachineArithmetic
MACHINEARITHMETIC_BRANCH ?= pure-z3
$(eval $(call git-clone-local,MACHINEARITHMETIC_DIR,$(MACHINEARITHMETIC_URL),$(MACHINEARITHMETIC_BRANCH)))
endif

include ../pharo.gmk

$(PROJECT).image: $(PHARO_VM) $(PHARO_IMAGE) ../src/*/*.st $(ARCHC_PDL_DIR)
$(PHARO_VM_HEADLESS) $(PHARO_IMAGE) save $(shell pwd)/$(PROJECT)
$(PHARO_VM_HEADLESS) $@ eval --save "EpMonitor current disable." || rm $@
ifdef MACHINEARITHMETIC_DIR
$(PHARO_VM_HEADLESS) $@ eval --save "(IceRepositoryCreator new location: '$(MACHINEARITHMETIC_DIR)/' asFileReference; createRepository) register" || rm $@
$(PHARO_VM_HEADLESS) $@ metacello install tonel://$(MACHINEARITHMETIC_DIR)/ BaselineOfMachineArithmetic || rm $@
ifndef ARCHC_PDL_DIR
ARCHC_PDL_DIR := ../pdl
ARCHC_PDL_URL ?= https://github.com/janvrany/Pharo-ArchC-PDL.git
ARCHC_PDL_BRANCH ?= master
$(eval $(call git-clone-local,ARCHC_PDL_DIR,$(ARCHC_PDL_URL),$(ARCHC_PDL_BRANCH)))
endif
$(PHARO_VM_HEADLESS) $@ eval --save "(IceRepositoryCreator new location: '..' asFileReference; createRepository) register" || rm $@
$(PHARO_VM_HEADLESS) $@ eval --save "Metacello new baseline: '$(PROJECT)'; repository: 'tonel://../src'; onConflictUseLoaded; load." || rm $@
$(PHARO_VM_HEADLESS) $@ eval --save "EpMonitor current enable." || rm $@

build: prereq $(PROJECT).image
@echo ""
@echo "To open Pharo $(PROJECT) image run:"
@echo ""
@echo " ARCHC_PDL_DIR=$(ARCHC_PDL_DIR)/ $(PHARO_VM) $(PROJECT).image"
@echo " make run"
@echo ""

$(PROJECT).image: ../src/*/*.st
$(call pharo-copy-image, $(PHARO_IMAGE), $@)
$(call pharo-load-local, $@, MachineArithmetic,$(MACHINEARITHMETIC_DIR))
$(call pharo-load-local, $@, ArchC, ../src)

run: build
ARCHC_PDL_DIR=$(ARCHC_PDL_DIR)/ $(PHARO_VM) $(PROJECT).image

test: $(PROJECT).image $(PHARO_VM)
#$(PHARO_VM_HEADLESS) $< test --fail-on-failure "$(PROJECT).*Tests.*"
ARCHC_PDL_DIR=$(ARCHC_PDL_DIR)/ $(PHARO_VM_HEADLESS) $< test --fail-on-failure \
test: build
ARCHC_PDL_DIR=$(ARCHC_PDL_DIR)/ $(PHARO_VM_HEADLESS) $(PROJECT).image test --fail-on-failure \
"ArchC-Core-Tests" \
"ArchC-RISCV-Tests" \
"ArchC-DSL-Tests"

clean:
rm -f $(PROJECT).image $(PROJECT).changes *Test.xml *.fuel
rm -fr pharo-local
clean::
rm -f $(PROJECT).image $(PROJECT).changes

mrproper:: clean

GNUmakefile.local::
@echo "# Local tunables. There's no need to change anything," >> $@
@echo "# suitable defaults are provided." >> $@
@echo "" >> $@
@echo "# To load MachineArithmetic from local directory, set MACHINEARITHMETIC_DIR" >> $@
@echo "# variable to directory where MachineArithmetic is cloned. If unset (default)" >> $@
@echo "# it will be fetched by Metacello as defined in ../src/BaselineOfArchC/BaselineOfArchC.class.st" >> $@
@echo "# MACHINEARITHMETIC_DIR=../../MachineArithmetic" >> $@
@echo "" >> $@
@echo "# To specify custom directory with PDLs, set ARCHC_PDL_DIR" >> $@
@echo "# variable to directory with PDLs. If unset (default)" >> $@
@echo "# it will be fetched by 'get-pdls.sh' script." >> $@
@echo "# ARCHC_PDL_DIR=../pdl" >> $@
@echo "" >> $@
.PHONY: all build run test clean mrproper
45 changes: 0 additions & 45 deletions stx.gmk

This file was deleted.

72 changes: 28 additions & 44 deletions stx/GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,70 +1,54 @@
PROJECT=ArchC

include GNUmakefile.local
all: build

ifndef ARCHC_PDL_DIR
ARCHC_PDL_DIR=../pdl
../makefiles/%.gmk:
git submodule update --init --recursive $(dir $@)

../pdl:
(cd .. && ./get-pdls.sh)
endif
-include GNUmakefile.local
include ../makefiles/stx.gmk
include ../makefiles/git.gmk

ifndef MACHINEARITHMETIC_DIR

MACHINEARITHMETIC_DIR=../MachineArithmetic

../MachineArithmetic:
git clone https://github.com/shingarov/MachineArithmetic $@
MACHINEARITHMETIC_DIR := ../3rdparty/MachineArithmetic
MACHINEARITHMETIC_URL ?= https://github.com/shingarov/MachineArithmetic
MACHINEARITHMETIC_BRANCH ?= pure-z3
$(eval $(call git-clone-local,MACHINEARITHMETIC_DIR,$(MACHINEARITHMETIC_URL),$(MACHINEARITHMETIC_BRANCH)))
endif

all: build

include ../stx.gmk
ifndef ARCHC_PDL_DIR
ARCHC_PDL_DIR := ../pdl
ARCHC_PDL_URL ?= https://github.com/janvrany/Pharo-ArchC-PDL.git
ARCHC_PDL_BRANCH ?= master
$(eval $(call git-clone-local,ARCHC_PDL_DIR,$(ARCHC_PDL_URL),$(ARCHC_PDL_BRANCH)))
endif

build: $(STX) $(ARCHC_PDL_DIR) $(MACHINEARITHMETIC_DIR)
build: prereq
@echo "To run Smalltalk/X with $(PROJECT) loaded, run:"
@echo ""
@echo " ARCHC_PDL_DIR=$(ARCHC_PDL_DIR)/ $(STX) --package-path .. --package-path $(MACHINEARITHMETIC_DIR) --load BaselineOf$(PROJECT)"
@echo ""
@echo "or use shortcut:"
@echo ""
@echo " make run"
@echo ""


run: $(STX) $(ARCHC_PDL_DIR) $(MACHINEARITHMETIC_DIR)
run: build
ARCHC_PDL_DIR=$(ARCHC_PDL_DIR)/ $(STX) \
--package-path .. \
--quick \
--package-path $(MACHINEARITHMETIC_DIR) \
--load BaselineOf$(PROJECT)
--package-path ../src \
--load BaselineOf$(PROJECT) \

test: $(STX) $(ARCHC_PDL_DIR) $(MACHINEARITHMETIC_DIR)
test: build
ARCHC_PDL_DIR=$(ARCHC_PDL_DIR)/ $(STX) \
--package-path .. \
--package-path $(MACHINEARITHMETIC_DIR) \
--package-path ../src \
--load BaselineOf$(PROJECT) \
--run Builder::ReportRunner -r Builder::TestReport --fail-on-failure \
-p ArchC-Core-Tests \
-p ArchC-RISCV-Tests \
-p ArchC-DSL-Tests
-p "ArchC-Core-Tests" \
-p "ArchC-RISCV-Tests" \
-p "ArchC-DSL-Tests"

clean:
rm -rf *Test.xml
clean::

mrproper:: clean

GNUmakefile.local::
@echo "# Local tunables. There's no need to change anything," >> $@
@echo "# suitable defaults are provided." >> $@
@echo "" >> $@
@echo "# To load MachineArithmetic from local directory, set MACHINEARITHMETIC_DIR" >> $@
@echo "# variable to directory where MachineArithmetic is cloned. If unset (default)" >> $@
@echo "# it will be fetched by Metacello as defined in ../src/BaselineOfArchC/BaselineOfArchC.class.st" >> $@
@echo "# MACHINEARITHMETIC_DIR=../../MachineArithmetic" >> $@
@echo "" >> $@
@echo "# To specify custom directory with PDLs, set ARCHC_PDL_DIR" >> $@
@echo "# variable to directory with PDLs. If unset (default)" >> $@
@echo "# it will be fetched by 'get-pdls.sh' script." >> $@
@echo "# ARCHC_PDL_DIR=../pdl" >> $@
@echo "" >> $@

.PHONY: all build run test clean mrproper

0 comments on commit 7d5af2c

Please sign in to comment.