refactored makefile
This commit is contained in:
@@ -1,32 +1,37 @@
|
|||||||
|
|
||||||
OUTPUT := output
|
SRC_DIR := ./
|
||||||
SINGLE := $(wildcard *.md)
|
OUT_DIR := ./output
|
||||||
MULTI := $(wildcard *.txt)
|
|
||||||
TARGET_S := $(SINGLE:.md=)
|
|
||||||
TARGET_M := $(MULTI:.txt=)
|
|
||||||
|
|
||||||
PANDOC_OPT = --template ./template.tex \
|
SRC := $(wildcard *.md)
|
||||||
|
PDF := $(addprefix $(OUT_DIR)/, $(SRC:.md=.pdf))
|
||||||
|
|
||||||
|
PANDOC_OPT := --template ./template.tex \
|
||||||
|
--pdf-engine pdflatex \
|
||||||
--listings
|
--listings
|
||||||
|
|
||||||
.PHONY: all clean out_dir test $(DIRECTORIES)
|
MK_DIR := $(OUT_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: all clean test
|
||||||
|
|
||||||
|
|
||||||
|
all: $(PDF)
|
||||||
|
|
||||||
all: $(TARGET_S) $(TARGETS_M)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OUTPUT)/*
|
rm -f $(MK_DIR)
|
||||||
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@echo "test test :)"
|
@echo "$(SRC)" | sed 's/ /\n/g'
|
||||||
@echo "$(MULTI)"
|
|
||||||
|
|
||||||
$(TARGET_S): out_dir
|
|
||||||
@pandoc $(PANDOC_OPT) $@.md -o $(OUTPUT)/$@.pdf
|
|
||||||
|
|
||||||
$(TARGET_M): out_dir
|
$(OUT_DIR)/%.pdf: %.md $(MK_DIR)
|
||||||
@pandoc $(PANDOC_OPT) $(shell cat $@.txt | xargs) -o $(OUTPUT)/$@.pdf
|
@pandoc $(PANDOC_OPT) \
|
||||||
|
-o $@ \
|
||||||
|
$<
|
||||||
|
|
||||||
out_dir:
|
|
||||||
@if [[ ! -d $(OUTPUT) ]]; then\
|
$(MK_DIR):
|
||||||
mkdir $(OUTPUT);\
|
mkdir -p $@
|
||||||
fi
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user