SHELL := /bin/bash #CUR_EX := $(shell basename $(CURDIR)) CUR_EX := $(notdir $(CURDIR)) CUR_EX_TEX := $(addsuffix .tex, $(CUR_EX)) CUR_EX_TXT := $(addsuffix .txt, $(CUR_EX)) GENERATOR_DIR := hartshorned_generator SAMPLE_FILE := $(addsuffix .html, sample_hartshorned) CONVERTER_FILE := $(addsuffix .txt, converter) NEXT_EX_FILE := $(addsuffix .txt, next_ex) .PHONY: all all: build clean; .PHONY: clean clean: basic_clean; rm -f $(SAMPLE_FILE) $(NEXT_EX_FILE) #mv $(CUR_EX_TEX) $(CUR_EX_TXT) #No longer needed (see below) cp $(CUR_EX_TEX) $(CUR_EX_TXT) .PHONY: basic_clean basic_clean: ; rm -f *.log *.lg *.tmp *.xref *.4tc *.aux *.idv *.4ct *.dvi .PHONY: build build: $(CUR_EX_TEX) prep; #Use my tex->html script ./$(CONVERTER_FILE) -p $(p) -d $(d) $(CUR_EX_TEX) mv $(addsuffix .html, $(CUR_EX)_new) $(addsuffix .html, $(CUR_EX)) #Use my script to add/update the previous exercise's next button ./$(NEXT_EX_FILE) -p $(p) .PHONY: prep .ONESHELL prep: $(CUR_EX_TEX); cp ../$(GENERATOR_DIR)/$(SAMPLE_FILE) . if [[ ! -f $(CONVERTER_FILE) ]] then cp ../$(GENERATOR_DIR)/$(CONVERTER_FILE) . fi cp ../$(GENERATOR_DIR)/$(NEXT_EX_FILE) . #No longer needed #I originally was getting rid of the .tex file and making it .txt, because neocities non-supporter accounts don't accept .tex files. However, unlike the GUI web uploader, the push command of neocities-cli just skips over "not allowed" files. So I can actually keep both the .tex and .txt files. #.ONESHELL $(CUR_EX_TEX): ; # if [[ -f $(CUR_EX_TXT) ]] # then # mv $(CUR_EX_TXT) $(CUR_EX_TEX) # fi