Makefile 2.43 KB
Newer Older
1
outdir=../certificates
2
3
4
5
6
7
8
9
10
installdir=C:\Users\filatov\Documents\Dropbox\Yann\certificates\PLU
distzip=$(outdir)/plu_ts_certificates.zip

# Do not forget to point it to the proper IUT public key 
# in order to generate IUT certificates using existing key pairs.
#IUT_PUBLIC_KEY := IUT.key

depdir=.deps
keydir=$(outdir)
11
GENOPTS := -C config.cfg
12
13
14
15
16

itscertgen="../itscertgen.exe"
profiles        := $(wildcard CERT_*.xml)
profiles_iut_at := $(wildcard CERT_IUT_*AT.xml)
profiles_other  := $(filter-out $(profiles_iut_at), $(profiles))
17
profiles_root   := $(wildcard CERT_*ROOT*.xml)
18
19
20
21
22

certificates_iut_at := $(patsubst %.xml, $(outdir)/%.crt, $(profiles_iut_at))
certificates_other  := $(patsubst %.xml, $(outdir)/%.crt, $(profiles_other))
certificates        := $(certificates_iut_at) $(certificates_other)

23
depends      := $(patsubst %.xml, $(depdir)/%.d, $(filter-out $(profiles_root),$(profiles)))
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
64
65
66
67
68
69
70
71
72
73
74
75
76
dirs         := $(sort $(outdir) $(keydir) $(depdir))

distfiles    := $(certificates_other) \
                $(wildcard $(patsubst %.crt, %.vkey, $(filter %_AT.crt %_EC.crt, $(certificates_other)))) \
                $(wildcard $(patsubst %.crt, %.ekey, $(filter %_AT.crt %_EC.crt, $(certificates_other))))

vendor_certs := $(wildcard vendors/*.zip)
vendors      := $(foreach z, $(patsubst vendors/%,%,$(vendor_certs)), $(firstword $(subst _, ,$(z))))
vendor_dirs  := $(addprefix $(outdir)/, $(vendors))


ifneq ($(sort $(IUT_PUBLIC_KEY)),)
  AT_GENOPTS = $(GENOPTS) -v $(IUT_PUBLIC_KEY)
else
  AT_GENOPTS = $(GENOPTS)
endif

all: $(dirs) $(certificates_iut_at) $(certificates_other) 

install: all $(installdir) $(installs)
$(installs): $(installdir)/% : $(outdir)/%
	cp -f $< $@
	
$(dirs) $(installdir): %:
	mkdir -p $@

echo:
	echo $(vendors)
clean:
	rm -f $(outdir)/* $(keydir)/* $(depdir)/*

dist: all vendors $(distzip)

vendors: $(vendor_dirs)
$(vendor_dirs): $(outdir)/%: 
	mkdir -p $@
	-rm -rf $@/*
	echo $<
	unzip -uo vendors/$**.zip -d $@

$(distzip): $(distfiles)
	zip -o -j $@ $^

$(certificates_other): $(outdir)/%.crt : %.xml
	$(itscertgen) -o $(outdir) $(GENOPTS) $<

$(certificates_iut_at): $(outdir)/%.crt : %.xml
	$(itscertgen) -o $(outdir) $(AT_GENOPTS) $<

$(depends): $(depdir)/%.d : %.xml
	@echo "Create $*.d"
	@mkdir -p $(depdir)
	@echo -n "$(outdir)/$*.crt: " > $@
77
	@cat $< | grep '<signer' | sed -e 's|^.*name="\([^"]*\)".*|\1|g' -e 's|\(\w*\)|$(outdir)/\1.crt|g' >> $@
78
79

include $(depends)