summaryrefslogtreecommitdiff
path: root/support/check-parens/Makefile
blob: 303fce307d42cff2606133399071aa003744f0ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Makefile to build check-parens executable and CTAN zipfile.

TARGET = check-parens
SOURCE = $(TARGET).cc $(TARGET)-defconfig.hxx
CONFIG = check-parens.conf

INSTALLDIR = ~/bin
CONFIGDIR = ~

CXXFLAGS = -Wall -g -O2

ZIP = $(TARGET).zip

default: $(TARGET)

dist: $(ZIP)

$(TARGET): $(SOURCE)
	$(CXX) $(CXXFLAGS) -o $@ $<

$(TARGET)-defconfig.hxx: $(CONFIG)
	( echo 'std::string defconfigstring = "\' ; \
	  grep -v '^#' $< | sed 's/\\/\\\\/g;s/$$/\\n\\/' ; \
	  echo '";' ) > $@

$(ZIP): $(SOURCE) Makefile README $(CONFIG)
	TEMPDIR=`mktemp -d` ; \
	mkdir -p $$TEMPDIR/$(TARGET) ; \
	cp -a $^ $$TEMPDIR/$(TARGET) ; \
	sed -i "s/@VERSION@/`date '+%Y.%m.%d'`/" \
		$$TEMPDIR/$(TARGET)/$(SOURCE) \
		$$TEMPDIR/$(TARGET)/README ; \
	( cd $$TEMPDIR && zip -r $@ $(TARGET) ) ; \
	cp $$TEMPDIR/$@ . ; \
	rm -rf $$TEMPDIR

install: $(TARGET) $(CONFIG)
	install -t $(INSTALLDIR) $^
	cp $(CONFIG) $(CONFIGDIR)/.$(CONFIG)

clean:
	rm -f $(TARGET) $(TARGET)-defconfig.hxx $(ZIP)

.PHONY: dist clean install