The install command was meant for exactly this purpose; installing a file to a location and setting its permissions. This combines the `cp` and `chmod` commands into one `install` command.
		
			
				
	
	
		
			12 lines
		
	
	
		
			327 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			327 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
PREFIX ?= /usr/local
 | 
						|
 | 
						|
output: dwmblocks.c blocks.h
 | 
						|
	cc `pkg-config --cflags x11` `pkg-config --libs x11` dwmblocks.c -o dwmblocks
 | 
						|
clean:
 | 
						|
	rm -f *.o *.gch dwmblocks
 | 
						|
install: output
 | 
						|
	mkdir -p $(DESTDIR)$(PREFIX)/bin
 | 
						|
	install -m 0755 dwmblocks $(DESTDIR)$(PREFIX)/bin/dwmblocks
 | 
						|
uninstall:
 | 
						|
	rm -f $(DESTDIR)$(PREFIX)/bin/dwmblocks
 |