We can happily stick to POSIX and the usual variable names, with the following exceptions: - pkg-config(1) is used to find libraries and compile flags - the new "static" target uses non-standard compiler and linker flags, though it's not the default target sdn is predestined for wild distribution, even the dynamically linked libc is rather suboptimal.
		
			
				
	
	
		
			20 lines
		
	
	
		
			587 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			587 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
.POSIX:
 | 
						|
SHELL = /bin/sh
 | 
						|
CXXFLAGS = -g -std=c++14 -Wall -Wextra -pedantic
 | 
						|
CPPFLAGS = `sed -ne 's/^project (\([^ )]*\).*/-DPROJECT_NAME="\1"/p' \
 | 
						|
	-e 's/^set (version \([^ )]*\).*/-DPROJECT_VERSION="\1"/p' CMakeLists.txt`
 | 
						|
 | 
						|
sdn: sdn.cpp CMakeLists.txt
 | 
						|
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $< -o sdn \
 | 
						|
	-lacl `pkg-config --libs --cflags ncursesw`
 | 
						|
static: sdn.cpp CMakeLists.txt
 | 
						|
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $< -o sdn \
 | 
						|
	-static-libstdc++ \
 | 
						|
	-Wl,--start-group,-Bstatic \
 | 
						|
	-lacl `pkg-config --static --libs --cflags ncursesw` \
 | 
						|
	-Wl,--end-group,-Bdynamic
 | 
						|
clean:
 | 
						|
	rm -f sdn
 | 
						|
 | 
						|
.PHONY: static clean
 |