-# each MetaPost graphic has it's own file,
-# so the basic definitions should get bundled out into an external file
-# (encourages reuse anyway, so it's good for you :p)
+THIS_DIR = $(shell basename $(PWD))
+SOURCE_FILES = main.tex
+OTHER_FILES = Makefile
+DIST_FILES = $(SOURCE_FILES) $(OTHER_FILES)
+DIST_FILE = $(THIS_DIR)_source.tar.gz
+DIST_DIR = $(THIS_DIR)
+# external variables: INSTALL_USER, INSTALL_HOST, INSTALL_DIR, SOURCE_DIR
all : main.pdf
view : all
xpdf main.pdf &
-%.pdf : %.tex *.tex
- pdflatex $<
- ../../tex/make_mp.sh
- pdflatex $<
+%.pdf : %.tex $(SOURCE_FILES)
+ pdflatex $(patsubst %.tex,%,$<)
+ pdflatex $(patsubst %.tex,%,$<)
semi-clean :
- rm -f *.1 *.log *.mp *.mpx *.aux *.out *.cut
- rm -f mp*.tex # remove metapost-generated tex
+ rm -f *.log *.aux *.out *.thm *.toc *.pre
clean : semi-clean
rm -f *.pdf
+
+$(DIST_FILE) : $(DIST_FILES)
+ mkdir $(DIST_DIR)
+ cp -Lrp $^ $(DIST_DIR)
+ tar -chozf $@ $(DIST_DIR)
+ rm -rf $(DIST_DIR)
+
+install : main.pdf
+ scp -p $< $(INSTALL_USER)@$(INSTALL_HOST):$(INSTALL_DIR)/$(THIS_DIR).pdf
+ scp -p $(DIST_FILE) $(INSTALL_USER)@$(INSTALL_HOST):$(SOURCE_DIR)
+ @date > $@