mirror of
				https://github.com/kastdeur/pipeband-music.git
				synced 2025-10-31 02:16:34 +01:00 
			
		
		
		
	Rewrite Makefile with directories as extra targets
This commit is contained in:
		
							parent
							
								
									efbfa5ab00
								
							
						
					
					
						commit
						321a31e879
					
				
					 2 changed files with 51 additions and 18 deletions
				
			
		
							
								
								
									
										66
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										66
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -1,28 +1,60 @@ | |||
| LILY := ./build | ||||
| # Variables
 | ||||
| ## Disables default SUFFIXES
 | ||||
| .SUFFIXES: | ||||
| 
 | ||||
| ## Define the command to compile .ly files
 | ||||
| ### Currently set to a wrapper script around lilypond, presupplying options
 | ||||
| ###+ ./build contains no-strip-output-dir, no-point-and-click, paper-size, preview
 | ||||
| LYFLAGS ?= | ||||
| LY = LYFLAGS=$(LYFLAGS) ./build | ||||
| 
 | ||||
| ## Auxiliary files that are not directly related to the source compilation
 | ||||
| AUX = README.md Makefile \
 | ||||
| 	  build defs.ily \
 | ||||
| 	  init-sets make-set \
 | ||||
| 	  scores2json.py \
 | ||||
| 	  tuneoverview shadowdir | ||||
| 	  #.git .gitignore | ||||
|       build defs.ily \
 | ||||
|       init-sets make-set \
 | ||||
|       scores2json.py \
 | ||||
|       tuneoverview shadowdir | ||||
|       # .git .gitignore | ||||
| 
 | ||||
| ## Define the directories containing source files (.ly files)
 | ||||
| SRCDIRS := 2-4_marches 3-4_marches 4-4_marches 5-4_marches \
 | ||||
| 		   6-8_marches 9-8_marches \
 | ||||
| 		   standards template \
 | ||||
| 		   airs hornpipes jigs reels strathspeys \
 | ||||
| 		   other christmas sinterklaas suites | ||||
|            6-8_marches 9-8_marches \
 | ||||
|            standards template \
 | ||||
|            airs hornpipes jigs reels strathspeys \
 | ||||
|            other christmas sinterklaas suites | ||||
| 
 | ||||
| LYSRCS := $(foreach dir,$(SRCDIRS),$(wildcard $(dir)/**/*.ly) $(wildcard $(dir)/*.ly)) | ||||
| PDFOBJS = $(patsubst %.ly,%.pdf,$(LYSRCS)) | ||||
| ## Gather all .ly files in the defined source directories (recursive search)
 | ||||
| LYSRCS := $(foreach dir, $(SRCDIRS), \
 | ||||
|             $(wildcard $(dir)/**/*.ly) \
 | ||||
|             $(wildcard $(dir)/*.ly) \
 | ||||
|            ) | ||||
| 
 | ||||
| ## Define the corresponding .pdf targets for each .ly source file
 | ||||
| PDFOBJS = $(patsubst %.ly, %.pdf, $(LYSRCS)) | ||||
| 
 | ||||
| #Targets
 | ||||
| ## Default target: generate all PDF files from .ly files
 | ||||
| .PHONY: all | ||||
| all: $(PDFOBJS) | ||||
| 
 | ||||
| # Pattern rules
 | ||||
| %.pdf %.preview.pdf %.preview.png &: %.ly | ||||
| 	$(LILY) $< | ||||
| 
 | ||||
| ## Distribution target: Create a tarball containing source and auxiliary files
 | ||||
| .PHONY: dist | ||||
| dist: $(LYSRCS) $(PDFOBJS) $(AUX) | ||||
| dist: $(PDFOBJS) $(AUX) | ||||
| 	@tar -zhvcf pipeband-music.tar.gz $(SRCDIRS) $(AUX) | ||||
| 
 | ||||
| ## Pattern rule for .ly to .pdf, .preview.pdf, and .preview.png compilation
 | ||||
| %.pdf : %.ly | ||||
| 	$(LY) $< | ||||
| 
 | ||||
| ## Register individual pdf targets
 | ||||
| ### This also allows for autocompletion
 | ||||
| $(PDFOBJS): %.pdf: %.ly | ||||
| 
 | ||||
| ## Handling subdirectories as targets
 | ||||
| SUBDIRS := $(addsuffix /,$(SRCDIRS)) $(foreach pdfobj, $(PDFOBJS), $(dir $(pdfobj))) | ||||
| ### Sort and remove duplicates
 | ||||
| SUBDIRS := $(sort $(SUBDIRS)) | ||||
| 
 | ||||
| .PHONY: $(SUBDIRS) | ||||
| $(SUBDIRS) : % : | ||||
| 	@$(MAKE) $(filter $(@D)/%.pdf,$(PDFOBJS)) | ||||
|  |  | |||
							
								
								
									
										3
									
								
								build
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								build
									
										
									
									
									
								
							|  | @ -23,4 +23,5 @@ BAGPIPELY="$LIB/bagpipe.ly/" | |||
| OPTIONS="-dno-strip-output-dir -dno-point-and-click -dpaper-size=\"a4landscape\"" | ||||
| 
 | ||||
| # Execute | ||||
| lilypond -dinclude-settings=$STYLESHEET -I $LILYDRUM -I $BAGPIPELY $OPTIONS -dpreview "$@" | ||||
| LYFLAGS="-dpreview${LYFLAGS+ }${LYFLAGS}" | ||||
| lilypond -dinclude-settings=$STYLESHEET -I $LILYDRUM -I $BAGPIPELY $OPTIONS $LYFLAGS "$@" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue