aboutsummaryrefslogtreecommitdiff
path: root/assemble.sh
blob: ed9b46e0c3af1162bc69f8930f1c4f9ec91f98c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

# NOTE: Only for macOS (intel)

if [ -z "$1" ]
then
    echo "Usage: $0 <path to nasm file>"
    exit 1
fi


case "$(uname -s)" in
   Darwin)
        set -xe
        nasm -f macho64 -o $1.o $1
        ld -lSystem $1.o
        set +xe
        ;;
   Linux)
        set -xe
        nasm -f elf64 -o $1.o $1
        ld $1.o
        set +xe
        ;;
esac