aboutsummaryrefslogblamecommitdiff
path: root/v2/dynamic.mk
blob: 06d9bbf3c0c5abb4dcb3d85a1bfbde93493943da (plain) (tree)
1
2
3
4
5
6
7
8
9
       






                    
          
                                             
 



                                                  


                    
         
                    
 

                        
 
 

                                         
                                         

 
           
 





                                                              
 

                
                                                                                

                                                                                

 
                                                                                                     
 

                                              
                                              
                                              
 





                                                                              
                                                        
                                                                                  
                                                                

                
                                                                             

                                                        
                                                                

                
                                                                                  
                                                                                  
                                                                                           


                                 
                                                     
                
 



                                                

                                             
 

                                                                                     

 


                                  
                                  





                     

        








                                                       

       
.POSIX:


default: all

include generated.mk


.SUFFIXES:
.SUFFIXES: .md .content .conf .html .xmlentry


.md.content:
	awk 'sep >= 2; /^---$$/ {sep++}' < $< > $@

.md.conf:
	conf $< > $@

.md.html:
	html $< > $@

.md.xmlentry:
	xmlentry $< > $@


derived-assets = \
	$(all-generated)                \
	$(feeds)                        \


all: public


$(all-generated.conf) $(all-generated.content): $(non-content)
$(all-generated.conf): src/lib/base.conf

$(all-generated.xml):
	feed $@

clean:
	rm -rf \
		public/ $(derived-assets) *.sentinel generated.mk po/po4a.cfg  \
		src/content/*/*.html.*.txt src/content/*/*/*.html.*.txt        \
		src/content/*/*/*.sortdata src/content/**/feeds/               \


public: $(derived-assets) symlink-mappings.sentinel copy-content.sentinel copy-code-snippets.sentinel

content = \
	$(all-generated.html)                \
	$(all-generated.xml)                 \
	$(static-content)                    \

symlink-mappings.sentinel: src/redirect.mappings content-mkdir.sentinel
	< src/redirect.mappings \
		awk '{ printf "ln -rfs public/%s public/%s\n", $$2, $$1 }' | \
		sh
	touch $@

copy-content.sentinel: $(content) content-mkdir.sentinel
	echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \
		xargs -P`nproc` -I% ln -f src/content/% public/%
	touch $@

copy-code-snippets.sentinel: $(all-generated.snippets) content-mkdir.sentinel
	echo $? | tr ' ' '\n' | grep '^src/content/' | \
		xargs sed 's|^src/content/||' | \
		xargs -P`nproc` -I% ln -f src/content/% public/%
	touch $@

content-mkdir.sentinel: $(content) $(all-generated.snippets) src/redirect.mappings
	echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \
		printf '%s\n%s\n' "`cat -`" "`awk '{print $$2}' src/redirect.mappings`" | \
		xargs dirname | \
		sort |          \
		uniq |          \
		xargs -P`nproc` -I% mkdir -p public/%
	touch $@


src/content/favicon.ico: src/content/favicon.svg
	convert src/content/favicon.svg $@

src/content/public.asc.txt:
	gpg --armour --export '$(EMAIL)' > $@

src/content/.well-known/security.txt: src/content/public.asc.txt src/bin/security-txt
	security-txt > $@



test-files = \
	aux/checks/shellcheck.sh \
	aux/checks/todos.sh      \

$(test-files): ALWAYS
	sh $@

check: $(test-files)
dev: all check

run: all
	serve -d public/

upload: public
	rsync \
		--rsync-path='sudo -u deployer rsync' \
		-avzP \
		--delete \
		--exclude 's/*' \
		public/ $(DOMAIN):/srv/www/

ALWAYS: