-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (34 loc) · 706 Bytes
/
Makefile
File metadata and controls
41 lines (34 loc) · 706 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
.PHONY: all
all: hello64
uname := $(shell uname)
ifeq ($(uname),Darwin)
format := mach
syscalls := osx
endif
ifeq ($(uname),Linux)
format := elf
syscalls := linux
endif
%.elf.o: %.asm
rm -f syscalls.inc
ln -s linux.inc syscalls.inc
fasm $< $*.o
objconv -felf -ar:start:_start $*.o $@
rm -f $*.o
rm -f syscalls.inc
%.mach.o: %.asm
rm -f syscalls.inc
ln -s osx.inc syscalls.inc
fasm $< $*.o
objconv -fmacho -ar:start:_start -nu $*.o $@
rm -f $*.o
rm -f syscalls.inc
%.$(format).exe: %.$(format).o
ld $< -o $@
%.elf.exe: %.elf.o
/usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-ld $< -o $@
%: %.$(format).exe
ln -f $< $@
.PHONY: clean
clean:
rm -f *.elf.o *.mach.o syscalls.inc