author | Markus Bröker<broeker.markus@googlemail.com> |
Fri, 20 Oct 2017 06:46:47 +0200 | |
changeset 170 | 5a11538e7bc8 |
parent 168 | dfb60716880c |
child 171 | c6e0af68825a |
permissions | -rw-r--r-- |
168
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
1 |
CC = gcc -g -ggdb |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
2 |
LD = ld |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
3 |
ARCH = -arch i386 |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
4 |
CFLAGS = -Wall -O2 -Iinclude |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
5 |
LDFLAGS = $(ARCH) |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
6 |
NASM = /usr/local/bin/nasm -f macho -Iinclude/ |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
7 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
8 |
TARGETS = helloASM |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
9 |
#TARGETS+= helloC |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
10 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
11 |
OBJECTS = hello.o main.o |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
12 |
ENTRYPOINT = entryPoint |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
13 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
14 |
.SUFFIXES: .c .asm |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
15 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
16 |
.c.o: |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
17 |
@echo Compiling $< ... |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
18 |
@$(CC) -c $(CFLAGS) $(ARCH) -o $@ $< |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
19 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
20 |
.asm.o: |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
21 |
@echo Assembling $< ... |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
22 |
@$(NASM) $< -o $@ |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
23 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
24 |
all: $(TARGETS) |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
25 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
26 |
helloC: $(OBJECTS) |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
27 |
@echo Linking $(OBJECTS) ... |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
28 |
$(CC) $(LDFLAGS) $(OBJECTS) -e $(ENTRYPOINT) -o $@ |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
29 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
30 |
helloASM: hello.o |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
31 |
@echo Linking $(OBJECTS) ... |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
32 |
$(LD) -static -e $(ENTRYPOINT) $< -o $@ |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
33 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
34 |
.PHONY: clean uninstall |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
35 |
|
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
36 |
clean: |
dfb60716880c
Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff
changeset
|
37 |
$(RM) *.o *~ $(TARGETS) |