author | Markus Bröker<broeker.markus@googlemail.com> |
Sun, 10 Feb 2019 13:17:01 +0100 | |
changeset 173 | 374a86886bc5 |
parent 172 | 43ae72f88d06 |
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 |
171
c6e0af68825a
Entrypoint and RET fixed
Markus Bröker<broeker.markus@googlemail.com>
parents:
168
diff
changeset
|
5 |
LDFLAGS = $(ARCH) -Wl,-no_pie |
c6e0af68825a
Entrypoint and RET fixed
Markus Bröker<broeker.markus@googlemail.com>
parents:
168
diff
changeset
|
6 |
NASM = nasm -f macho32 -Iinclude -g |
168
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 |
171
c6e0af68825a
Entrypoint and RET fixed
Markus Bröker<broeker.markus@googlemail.com>
parents:
168
diff
changeset
|
9 |
TARGETS+= helloC |
168
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 |
172
43ae72f88d06
2er Komplement und integerToString
Markus Bröker<broeker.markus@googlemail.com>
parents:
171
diff
changeset
|
12 |
ENTRYPOINT = start |
168
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) ... |
171
c6e0af68825a
Entrypoint and RET fixed
Markus Bröker<broeker.markus@googlemail.com>
parents:
168
diff
changeset
|
28 |
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ |
168
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) |