aboutsummaryrefslogblamecommitdiff
path: root/v2/dynamic.mk
blob: 916becd3937e62824cd5f9d9ea54d019d4f55887 (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) public-copy-content.sentinel public-copy-code-snippets.sentinel

public-mkdir.sentinel:
	mkdir -p public
	touch $@

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

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

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

public-content-mkdir.sentinel: $(content) $(all-generated.snippets)
	echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \
		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: