Website:doc/note subdir and Makefile tree for publishing latex/notes.
[course.git] / latex / notes / topics / linear_algebra / Makefile
index 6be3b9bad6b472fba0e95c97afcb5f0278c9298d..44a7d4053096e9a6b9e7c00a345a58ac3e4f6242 100644 (file)
@@ -1,20 +1,33 @@
-# 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 > $@