mirror of
				https://github.com/ItsDrike/dotfiles.git
				synced 2025-11-04 01:16:35 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			13 lines
		
	
	
	
		
			400 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
	
		
			400 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/bin/sh
 | 
						|
# Compile given file
 | 
						|
 | 
						|
file=$(readlink -f "$1")
 | 
						|
base="$(dirname "$file")/$(basename "$file" | sed 's/\..*//')"
 | 
						|
 | 
						|
case "$file" in
 | 
						|
    *.md) pandoc --filter pandoc-crossref "$file" -o "$base".pdf ;;
 | 
						|
    *.asm) nasm -f elf64 "$file" -o "$base".o && ld "$base".o -o "$base" ;;
 | 
						|
    *.c) gcc "$file" -o "$base" ;;
 | 
						|
    *.cpp) g++ "$file" -o "$base" ;;
 | 
						|
    *) echo "Can't compile!" && exit 1 ;;
 | 
						|
esac
 |