Skip to content

Commit

Permalink
Stdlib compiles twice
Browse files Browse the repository at this point in the history
Signed-off-by: Kakadu <[email protected]>
  • Loading branch information
Kakadu committed Aug 30, 2024
1 parent 928d038 commit 0053a25
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 51 deletions.
24 changes: 14 additions & 10 deletions stdlib/Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
.PHONY: all

SHELL := /bin/bash
FILES=$(wildcard *.lama)
ALL=$(sort $(FILES:.lama=.o))
SRCDIR ?= .
FILES ?= $(wildcard $(SRCDIR)/*.lama)
OFILES = $(FILES:$(SRCDIR)/%=%)
OFILES := $(OFILES:.lama=.o)
$(info OFILES = $(OFILES))
ALL := $(sort $(OFILES))
LAMAC ?= ../src/lamac
BDIR ?= .

all: $(addprefix $(BDIR)/,$(ALL))
$(info ALL = $(ALL))
$(BDIR)/Fun.o: $(BDIR)/Ref.o

Fun.o: Ref.o
$(BDIR)/Data.o: $(BDIR)/Ref.o $(BDIR)/Collection.o

Data.o: Ref.o Collection.o

Collection.o: List.o Ref.o
$(BDIR)/Collection.o: $(BDIR)/List.o $(BDIR)/Ref.o

$(BDIR)/Array.o: $(BDIR)/List.o

Ostap.o: List.o Collection.o Ref.o Fun.o Matcher.o
$(BDIR)/Random.o $(BDIR)/Collection.o: $(BDIR)/Array.o
$(BDIR)/Ostap.o: $(BDIR)/List.o $(BDIR)/Collection.o $(BDIR)/Ref.o $(BDIR)/Fun.o $(BDIR)/Matcher.o $(BDIR)/Data.o

$(BDIR)/Buffer.o: $(BDIR)/List.o

$(BDIR)/STM.o: $(BDIR)/List.o $(BDIR)/Fun.o

$(BDIR)/%.o: %.lama
LAMA=../runtime $(LAMAC) -g -I . -c $< -o $@
$(BDIR)/%.o: $(SRCDIR)/%.lama
$(LAMAC) -g -I . -c $< #-o $@

clean:
$(RM) -r *.s *.o *.i *~
Expand Down
51 changes: 44 additions & 7 deletions stdlib/amd64/dune
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
(rule
(deps ../List.lama ../Makefile ../../runtime/Std.i)
(targets List.i List.o)
(deps
../Makefile
../../runtime/Std.i
../List.lama
%{project_root}/src/Driver.exe)
(targets
List.i
List.o
Buffer.i
Buffer.o
Collection.i
Collection.o
Data.i
Data.o
Fun.i
Fun.o
Lazy.i
Lazy.o
List.i
List.o
Matcher.i
Matcher.o
Ostap.i
Ostap.o
Random.i
Random.o
Ref.i
Ref.o
STM.i
STM.o
Timer.i
Timer.o)
(mode
(promote (until-clean)))
(action
(progn
(setenv
BDIR
"amd64"
SRCDIR
".."
; (setenv
; FILES
; "List.lama Buffer.lama Collection.lama Data.lama Fun.lama"
(setenv
LAMA
"../runtime"
"../../runtime"
(setenv
LAMAC
"../src/Driver.exe -I ../runtime"
(run make -C .. all)))))))
"../../src/Driver.exe -march=amd64 -I ../runtime32"
(run make -j2 -f ../Makefile all)))))))

;)
82 changes: 48 additions & 34 deletions stdlib/x32/dune
Original file line number Diff line number Diff line change
@@ -1,38 +1,52 @@
(rule
(targets List.o List.i)
(deps
(:lama ../List.lama)
%{project_root}/runtime32/runtime32.a
%{project_root}/runtime32/Std.i)
(action
(setenv
LAMA
"../../runtime32"
(run
%{project_root}/src/Driver.exe
-march=x86
-I
%{project_root}/runtime32
-c
%{lama}))))

(rule
(targets Array.o Array.i)
(deps
(:lama ../Array.lama)
%{project_root}/runtime32/Std.i
../Makefile
../../runtime/Std.i
../List.lama
%{project_root}/src/Driver.exe)
(targets
List.i
List.o
Buffer.i
Buffer.o
Collection.i
Collection.o
Data.i
Data.o
Fun.i
Fun.o
Lazy.i
Lazy.o
List.i
List.o)
List.o
Matcher.i
Matcher.o
Ostap.i
Ostap.o
Random.i
Random.o
Ref.i
Ref.o
STM.i
STM.o
Timer.i
Timer.o)
(mode
(promote (until-clean)))
(action
(setenv
LAMA
"../../runtime32"
(run
%{project_root}/src/Driver.exe
-march=x86
-I
.
-I
%{project_root}/runtime32
-c
%{lama}))))
(progn
(setenv
SRCDIR
".."
; (setenv
; FILES
; "List.lama Buffer.lama Collection.lama Data.lama Fun.lama"
(setenv
LAMA
"../../runtime32"
(setenv
LAMAC
"../../src/Driver.exe -march=x86 -I ../runtime32"
(run make -j2 -f ../Makefile all)))))))

;)

0 comments on commit 0053a25

Please sign in to comment.