forked from stefanmiodrag/conductor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (49 loc) · 1.71 KB
/
Makefile
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
CXXFLAGS =-std=c99 -pipe -g -Wall -Wextra -pedantic
CFLAGS ?=
LDFLAGS =
LIBS = -lcrypto -lkrb5 -lcom_err -lldap -lgssapi_krb5 -lsasl2
PREFIX ?= /usr/local
DESTDIR ?=
VERSION = $(shell git describe --tags | head -n1)
OBJS +=
BINS = conductor
conductor_OBJS := $(OBJS) src/parse.o src/scanner.o src/main.o
all: $(BINS)
define BIN_template =
$(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
ALL_OBJS += $$($(1)_OBJS)
endef
$(foreach bin,$(BINS),$(eval $(call BIN_template,$(bin))))
$(BINS):
$(CC) $(CFLAGS) $(LIBS) $(LDFLAGS) -o $@ ${$@_OBJS}
src/scanner.c: src/scanner.l src/parse.c
$(LEX) --header-file --yylineno --outfile=$@ $<
src/parse.c: src/parse.y
$(YACC) -d --output-file=src/parse.c $<
src/%.o: src/%.c
$(CC) -c -o $@ $(CFLAGS) $(CXXFLAGS) $<
schema:
rm -rf man/ldif
mkdir -p man/ldif
@echo "include /etc/openldap/schema/core.schema" > man/schema-convert.conf
@echo "include $(PWD)/man/conductor.schema" >> man/schema-convert.conf
slaptest -f man/schema-convert.conf -F man/ldif
cp man/ldif/cn=config/cn=schema/cn={1}conductor.ldif man/conductor-schema.ldif
sed -e '/entryUUID/d' -e '/creatorsName/d' \
-e '/modifyTimestamp/d' -e '/createTimestamp/d' \
-e '/modifiersName/d' -e '/^#/d' -e '/entryCSN/d' \
-e 's/{1}conductor/conductor/' \
-e 's/^dn:\ .*/dn:\ cn=conductor,cn=schema,cn=config/' \
-i man/conductor-schema.ldif
man/%: man/%.pod
pod2man $< > $@
doc: man/conductor.1
install: conductor doc
strip conductor
install -m 0755 -D conductor $(DESTDIR)$(PREFIX)/bin/conductor
gzip man/conductor.1 -c > conductor.1.gz
install -m 0644 -D conductor.1.gz $(DESTDIR)$(PREFIX)/share/man/man1/conductor.1.gz
rm conductor.1.gz
clean:
rm -f conductor *.o src/*.o src/parse.[ch] src/scanner.c
rm -f *.pem