| 
									
										
										
										
											2019-06-26 11:18:03 +01:00
										 |  |  | # This Makefile generates the manual pages from the markdown README.mds. It depends
 | 
					
						
							|  |  |  | # on https://github.com/mmarkdown/mmark to be installed. Generally we want this to be
 | 
					
						
							|  |  |  | # updated before doing a release. The Debian package, for instance, looks at these pages
 | 
					
						
							|  |  |  | # and will install them on your system.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | MMARK:=mmark -man | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | PLUGINS:=$(wildcard plugin/*/README.md) | 
					
						
							|  |  |  | READMES:=$(subst plugin/,,$(PLUGINS)) | 
					
						
							|  |  |  | READMES:=$(subst /README.md,,$(READMES)) | 
					
						
							| 
									
										
										
										
											2018-06-13 11:02:14 +01:00
										 |  |  | PLUGINS:=$(subst plugin/,coredns-,$(PLUGINS)) | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | PLUGINS:=$(subst /README.md,(7),$(PLUGINS)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | ifeq (, $(shell which mmark)) | 
					
						
							|  |  |  |     $(warning "No mmark in $$PATH, exiting, see github.com/mmarkdown/mmark") | 
					
						
							| 
									
										
										
										
											2018-01-26 16:57:08 +00:00
										 |  |  | all: | 
					
						
							|  |  |  | 	@echo "noop" | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2018-01-11 09:46:40 +00:00
										 |  |  | all: man/coredns.1 man/corefile.5 plugins | 
					
						
							| 
									
										
										
										
											2018-01-26 16:57:08 +00:00
										 |  |  | endif | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | man/coredns.1: coredns.1.md | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 	@/bin/echo -e '%%%\n title = "coredns 1"\n' \
 | 
					
						
							|  |  |  | 		'area = "CoreDNS"\n workgroup = "CoreDNS"\n%%%\n\n' > $@.header | 
					
						
							|  |  |  | 	@cat $@.header $< > $@.md && rm $@.header | 
					
						
							|  |  |  | 	@sed -i -e "s/@@PLUGINS@@/$(PLUGINS)/" $@.md | 
					
						
							|  |  |  | 	$(MMARK) $@.md > $@ && rm $@.md | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-06 15:53:33 +00:00
										 |  |  | man/corefile.5: corefile.5.md | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 	@/bin/echo -e '%%%\n title = "corefile 5"\n' \
 | 
					
						
							|  |  |  | 		'area = "CoreDNS"\n workgroup = "CoreDNS"\n%%%\n\n' > $@.header | 
					
						
							|  |  |  | 	@cat $@.header $< > $@.md && rm $@.header | 
					
						
							|  |  |  | 	$(MMARK) $@.md > $@ && rm $@.md | 
					
						
							| 
									
										
										
										
											2018-01-06 15:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | .PHONY: plugins | 
					
						
							|  |  |  | plugins: | 
					
						
							|  |  |  | 	for README in $(READMES); do \
 | 
					
						
							|  |  |  | 	    $(MAKE) -f Makefile.doc man/coredns-$$README.7; \
 | 
					
						
							|  |  |  | 	done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | man/coredns-%.7: plugin/%/README.md | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 	@/bin/echo -e "%%%\n title = \"`basename $@ | sed s\/\.7\/\/` 7\"\n" \
 | 
					
						
							|  |  |  | 		'area = "CoreDNS"\n workgroup = "CoreDNS Plugins"\n%%%\n\n' > $@.header | 
					
						
							|  |  |  | 	@cat $@.header $< > $@.md && rm $@.header | 
					
						
							| 
									
										
										
										
											2019-04-06 14:09:05 +01:00
										 |  |  | 	@sed -i '/^# .*/d' $@.md | 
					
						
							| 
									
										
										
										
											2019-04-06 08:42:40 +01:00
										 |  |  | 	$(MMARK) $@.md > $@ && rm $@.md | 
					
						
							| 
									
										
										
										
											2018-01-04 12:53:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | PHONY: clean | 
					
						
							|  |  |  | clean: | 
					
						
							|  |  |  | 	rm -f man/* |