Skip to content

Commit

Permalink
Avoid unnecessary recompilation
Browse files Browse the repository at this point in the history
Make doesn’t mesh well with javac, which does its own dependency
tracking, but we can at least avoid recompiling unchanged classes by
passing the build directory with -classpath.

Also move the manifest out of Makefile instead of recreating it for
every build.
  • Loading branch information
Timotej Lazar committed Feb 8, 2023
1 parent 53a61ec commit e99a7c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path: .
Main-Class: sic.Sim
36 changes: 12 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
OUT=out/make


all: outdir sim vm asm link


outdir:
mkdir -p $(OUT)
OUT = out/make

all: sim vm asm link

sim:
cd src; javac -encoding UTF-8 -d "../$(OUT)" sic/Sim.java
@mkdir -p "$(OUT)"
cp -R img "$(OUT)"

javac -encoding UTF-8 -sourcepath src -classpath "$(OUT)" -d "$(OUT)" src/sic/Sim.java

vm:
cd src; javac -encoding UTF-8 -d "../$(OUT)" sic/VM.java

@mkdir -p "$(OUT)"
javac -encoding UTF-8 -sourcepath src -classpath "$(OUT)" -d "$(OUT)" src/sic/VM.java

asm:
cd src; javac -encoding UTF-8 -d "../$(OUT)" sic/Asm.java

@mkdir -p "$(OUT)"
javac -encoding UTF-8 -sourcepath src -classpath "$(OUT)" -d "$(OUT)" src/sic/Asm.java

link:
cd src; javac -encoding UTF-8 -d "../$(OUT)" sic/Link.java


manifest:
printf "Manifest-Version: 1.0\nClass-Path: .\nMain-Class: sic.Sim\n" >"$(OUT)/MANIFEST.MF"


jar: all manifest
cd "$(OUT)"; jar cfm sictools.jar MANIFEST.MF *
@mkdir -p "$(OUT)"
javac -encoding UTF-8 -sourcepath src -classpath "$(OUT)" -d "$(OUT)" src/sic/Link.java

jar: all
jar --create --file "$(OUT)/sictools.jar" --manifest MANIFEST.MF -C "$(OUT)" .

clean:
rm -rf "$(OUT)"


upload:
scp "$(OUT)/sictools.jar" jure@lalg.fri.uni-lj.si:public_html/

2 comments on commit e99a7c0

@Kljunas2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to work as expected. I changed a file and it didn't recompile it.

@jetomit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to work as expected.

True, thanks for reporting this. I partially reverted the change in eaaf797, which should still at least reduce the time to make all. I hope the broken version didn’t waste too much of your time. ^^

Please sign in to comment.