73 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| VERSION = 1.0.2
 | |
| PREFIX ?= /usr/local
 | |
| 
 | |
| OS != uname -o
 | |
| 
 | |
| SOURCES := src/pathsd.nim
 | |
| VENDOR_SOURCES := submodules/commandant/commandant.nim
 | |
| ALL_SOURCES := $(SOURCES) $(VENDOR_SOURCES)
 | |
| 
 | |
| ALL_STAMPS := ${ALL_SOURCES:.nim=.stamp}
 | |
| 
 | |
| OUT := build/pathsd
 | |
| 
 | |
| .POSIX:
 | |
| .SUFFIXES:
 | |
| .SUFFIXES: .stamp .nim
 | |
| .PHONY: all test install-license install-license-freebsd install clean sdist bdist-freebsd
 | |
| 
 | |
| all: $(OUT)
 | |
| 
 | |
| build:
 | |
| 	mkdir build
 | |
| 
 | |
| dist:
 | |
| 	mkdir dist
 | |
| 
 | |
| # This is such a hack. I love it ;).
 | |
| .nim.stamp:
 | |
| 	touch $@
 | |
| 
 | |
| $(OUT): build $(ALL_STAMPS)
 | |
| 	nimble build -d:release
 | |
| 
 | |
| test:
 | |
| 	nimble test
 | |
| 
 | |
| install-license:
 | |
| 	install LICENSE "$(DESTDIR)$(PREFIX)/share/doc/pathsd/"
 | |
| 
 | |
| install-license-freebsd:
 | |
| 	install -d "$(DESTDIR)$(PREFIX)/share/licenses/pathsd-$(VERSION)/"
 | |
| 	install freebsd/LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/pathsd-$(VERSION)/"
 | |
| 	install freebsd/catalog.mk "$(DESTDIR)$(PREFIX)/share/licenses/pathsd-$(VERSION)/" # Hmm?
 | |
| 	install LICENSE "$(DESTDIR)$(PREFIX)/share/licenses/pathsd-$(VERSION)/MIT"
 | |
| 
 | |
| install: $(OUT) dist
 | |
| 	install -d "$(DESTDIR)$(PREFIX)/bin"
 | |
| 	install -d "$(DESTDIR)$(PREFIX)/share/doc/pathsd"
 | |
| 
 | |
| 	install -s build/pathsd "$(DESTDIR)$(PREFIX)/bin/"
 | |
| 	install README.md "$(DESTDIR)$(PREFIX)/share/doc/pathsd/"
 | |
| 	install CHANGELOG.md "$(DESTDIR)$(PREFIX)/share/doc/pathsd/"
 | |
| 	install NOTICE.txt "$(DESTDIR)$(PREFIX)/share/doc/pathsd/"
 | |
| 
 | |
| 	if [ "$(OS)" = "FreeBSD" ];then make install-license-freebsd; else make install-license; fi
 | |
| 
 | |
| clean:
 | |
| 	nimble clean
 | |
| 	rm -f $(ALL_STAMPS)
 | |
| 	rm -rf build/ dist/
 | |
| 
 | |
| sdist: build dist
 | |
| 	rm -rf build/sdistroot/pathsd-${VERSION}
 | |
| 	mkdir -p build/sdistroot/pathsd-${VERSION}
 | |
| 	git ls-files --recurse-submodules | cpio -pd build/sdistroot/pathsd-${VERSION}
 | |
| 	(cd build/sdistroot; tar cvf ../../dist/pathsd-${VERSION}.tar.gz pathsd-${VERSION}/)
 | |
| 
 | |
| bdist-freebsd: $(OUT) dist
 | |
| 	make install DESTDIR=build/pkgroot
 | |
| 	cat freebsd/manifest.in | sed -e 's|%%VERSION%%|${VERSION}|' | sed -e 's|%%PREFIX%%|${PREFIX}|' | sed -e 's|%%FLATSIZE%%|${:! du -c build/pkgroot | tail -n 1 | cut -f 1!:}|' > build/manifest
 | |
| 	echo ${:! find build/pkgroot -type f !:C/^build\/pkgroot//} | tr ' ' '\n' > build/pkg-plist
 | |
| 	pkg create -M build/manifest -p build/pkg-plist -r build/pkgroot/ -o dist/ -f tgz
 |