magarena/Makefile

214 lines
7.5 KiB
Makefile
Raw Normal View History

JAVAEA=java -ea -Xms256M -Xmx256M -Ddebug=true
2011-07-08 01:11:44 -07:00
LIBS=.
2011-07-27 22:02:13 -07:00
JAVA=java -Xms256M -Xmx256M -Ddebug=true -Dcom.sun.management.jmxremote -cp $(LIBS):release/Magarena.jar
SHELL=/bin/bash
BUILD=build
2011-07-08 01:11:44 -07:00
JOPTS=-Xlint:all -d $(BUILD) -cp $(LIBS):$(BUILD):.
SRC=$(shell find src -iname *.java)
MAG:=release/Magarena.jar
EXE:=release/Magarena.exe
2011-05-22 19:23:49 -07:00
all: $(MAG) $(EXE) tags
check_literals:
grep "\"" src/magic/card/* | awk -f scripts/check_literals.awk
cubes: \
release/mods/legacy_cube.txt \
release/mods/extended_cube.txt \
release/mods/standard_cube.txt \
release/mods/modern_cube.txt
2011-06-09 19:09:19 -07:00
2011-08-25 23:40:03 -07:00
themes: \
release/mods/felt_theme.zip \
release/mods/blackswamp_theme.zip \
release/mods/bluemarble_theme.zip \
release/mods/darkbattle_theme.zip \
release/mods/gothic_theme.zip \
release/mods/greenforest_theme.zip \
release/mods/moon_theme.zip \
release/mods/mystic_theme.zip \
release/mods/nature_theme.zip \
release/mods/redfire_theme.zip \
release/mods/whiteangel_theme.zip
2011-06-09 19:09:19 -07:00
release/mods/legacy_cube.txt: cards/existing.txt cards/legacy_banned.txt
join -v1 -t"|" <(sort $(word 1,$^)) <(sort $(word 2,$^)) > $@
release/mods/%_cube.txt: cards/existing.txt cards/%_all.txt
join -t"|" <(sort $(word 1,$^)) <(sort $(word 2,$^)) > $@
cards/modern_all.txt:
curl "http://magiccards.info/query?q=cmc%3D0+f%3Amodern&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' > $@
curl "http://magiccards.info/query?q=cmc%3D1+f%3Amodern&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D2+f%3Amodern&s=cname&v=olist&p=1" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D2+f%3Amodern&s=cname&v=olist&p=2" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D3+f%3Amodern&s=cname&v=olist&p=1" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D3+f%3Amodern&s=cname&v=olist&p=2" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D4+f%3Amodern&s=cname&v=olist&p=1" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D4+f%3Amodern&s=cname&v=olist&p=2" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D5+f%3Amodern&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc>%3D6+f%3Amodern&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
cards/extended_all.txt:
curl "http://magiccards.info/query?q=cmc%3D0+f%3Aextended&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' > $@
curl "http://magiccards.info/query?q=cmc%3D1+f%3Aextended&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D2+f%3Aextended&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D3+f%3Aextended&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D4+f%3Aextended&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc%3D5+f%3Aextended&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
curl "http://magiccards.info/query?q=cmc>%3D6+f%3Aextended&s=cname&v=olist" | grep "en/" | sed 's/<[^>]*>//g' >> $@
cards/standard_all.txt:
curl "http://magiccards.info/query?q=f%3Astandard&s=cname&v=olist&p=1" | grep "en/" | sed 's/<[^>]*>//g' > $@
curl "http://magiccards.info/query?q=f%3Astandard&s=cname&v=olist&p=2" | grep "en/" | sed 's/<[^>]*>//g' >> $@
cards/existing.txt: resources/magic/data/cards.txt resources/magic/data/cards2.txt
cat $^ | grep "^>" | sed 's/>//' | sort > $@
cards/existing_full.txt: newcards/existing.txt cards/mtg-data.txt
awk -f scripts/extract_existing.awk $^ > $@
cards/candidates_full.txt: scripts/extract_candidates.awk cards/candidates.txt cards/mtg-data.txt
awk -f $^ | sort -rg | sed 's/\t/\n/g' > $@
%.out: $(MAG)
2011-06-10 23:03:02 -07:00
SGE_TASK_ID=$* exp/eval_mcts.sh
M1.%:
grep "VERSION.*1.$*" -r src/*
-rm -rf Magarena-1.$*
-rm Magarena-1.$*.zip
mkdir -p Magarena-1.$*/Magarena/mods
2011-05-27 00:34:47 -07:00
cp \
release/gpl-3.0.html \
release/Magarena.exe \
release/Magarena.sh \
release/Magarena.command \
release/README.txt \
Magarena-1.$*
cp -r \
release/avatars \
release/decks \
release/sounds \
Magarena-1.$*/Magarena
cp \
release/mods/felt_theme.zip \
release/mods/*.txt \
Magarena-1.$*/Magarena/mods
-zip -r Magarena-1.$*.zip Magarena-1.$*
2011-05-27 00:34:47 -07:00
$(MAG): $(SRC)
ant
2011-06-10 06:43:32 -07:00
class: $(BUILD)/javac.last
$(BUILD)/javac.last: $(SRC)
-mkdir $(BUILD)
javac $(JOPTS) $?
2011-05-24 20:57:28 -07:00
cp -r resources/* $(BUILD)
touch $@
tags: $(SRC)
ctags -R .
2011-05-22 19:23:49 -07:00
.Test%: $(MAG)
2011-06-17 21:11:53 -07:00
$(JAVA) -DtestGame=Test$* -jar $^
$(EXE): $(MAG)
cd launch4j; ./launch4j ../release/magarena.xml
2011-05-22 19:40:28 -07:00
2011-05-22 19:23:49 -07:00
clean:
-ant clean
-rm $(BUILD)/javac.last
-rm $(MAG)
jar: $(MAG)
$(JAVA) -jar $^
2011-05-22 19:23:49 -07:00
2011-06-20 00:12:39 -07:00
%.g: $(MAG)
2011-07-08 01:11:44 -07:00
$(JAVA) -DrndSeed=$* magic.MagicMain |& tee $*.log
%.t: $(MAG)
echo `hg id -n` > $*.log
$(JAVA) -DrndSeed=$* -DselfMode magic.MagicMain |& tee -a $*.log
%.d: $(MAG)
$(JAVAEA) -DrndSeed=$* -jar $^ |& tee $*.log
2011-05-22 19:23:49 -07:00
test: $(MAG)
$(JAVA) -DrndSeed=123 magic.DeckStrCal \
2011-05-24 02:05:39 -07:00
--deck1 release/decks/LSK_G.dec \
--ai1 VEGAS \
--deck2 release/decks/LSK_G.dec \
2011-05-22 19:23:49 -07:00
--ai2 RND --games 10 --strength 3
exp/%.log: $(MAG)
scripts/evaluate_ai.sh $* > $@
decks/dd_%.dec: scripts/dailyhtml2dec.awk
curl "http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtg/daily/deck/$*" | awk -f $^ > $@
decks/ml_%.dec: scripts/apprentice2dec.awk
wget "http://www.magic-league.com/decks/download.php?deck=$*&index=1" -O - | flip -u - | awk -f $^ > $@
# Mike Flores 1 - 212
decks/mf_%.dec: scripts/dailyhtml2dec.awk
curl http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtgcom/daily/mf$* | awk -f $^ > $@
# Top Decks 1 - 147
decks/td_%.dec: scripts/dailyhtml2dec.awk
curl http://www.wizards.com/Magic/Magazine/Article.aspx?x=mtg/daily/td/$* | awk -f $^ > $@
ref/rules.txt:
curl http://www.wizards.com/magic/comprules/MagicCompRules_20110617.txt | fmt -s > $@
flip -u $@
2011-06-20 18:58:22 -07:00
resources/magic/data/icons/missing_card.png:
2011-06-20 19:27:14 -07:00
convert -background gray -bordercolor black -border 5x5 -size 302x435 \
-pointsize 30 label:'\nNo card image found\n\nSelect\n\"Download images\"\nfrom Arena menu\n\nOR\n\nSwitch to text mode\nusing the Enter key' $@
2011-06-22 19:02:22 -07:00
release/mods/%_theme.zip: release/mods/%_theme
zip -j $@ $^/*
cards/evan_cube.txt:
curl http://www.cubedrafting.com/view-the-cube/ | grep jTip | sed "s/<[^>]*>//g;s/\&\#8217;/'/" > $@
cards/brett_cube.txt:
curl http://www.snazzorama.com/magic/cube/ | grep ":WizardsAutoCard" | sed "s/<\/td>.*//;s/<[^>]*>//g;s/\&\#8217;/'/" > $@
2011-06-28 19:05:50 -07:00
cards/tom_cube.txt:
wget -O - http://www.tomlapille.com/cube/tom_list.html | sed 's/<[^>]*>//g;s/^[ ]*//g;/^$$/d' > $@
cards/adam_cube.txt:
wget -O - http://www.tomlapille.com/cube/adam_list.html | sed 's/<[^>]*>//g;s/^[ ]*//g;/^$$/d' > $@
cards/AWinnarIsYou_cube.txt:
wget -O - http://www.tomlapille.com/cube/winnar_list.html | sed 's/<[^>]*>//g;s/^[ ]*//g;/^$$/d' > $@
2011-06-28 19:05:50 -07:00
daily: $(EXE)
mv $^ Magarena_`hg id -n`.exe
scripts/googlecode_upload.py \
-s "build `hg id -n`" \
-p magarena \
-u melvinzhang@gmail.com \
-w `cat ~/Modules/notes/keys/googlecode_pw.txt` \
Magarena_`hg id -n`.exe
2011-07-01 00:39:22 -07:00
cards/scriptable.txt: scripts/analyze_cards.scala scripts/effects.txt cards/cards.xml
scala $^ > $@ 2> cards/others.txt
cards/magicdraftsim-rating: cards/card-ratings
for i in `cat $^`; do \
curl http://www.magicdraftsim.com/card-ratings/$$i | \
html2text | \
grep "^[0-9]" | \
sed "s/^[0-9]*/$$i/"; \
done > $@
cards/current-magic-excel.txt:
wget http://www.magictraders.com/pricelists/current-magic-excel.txt -O $@
pull-beholder:
hg pull https://code.google.com/r/beholder1-magarena/