-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
28 lines (21 loc) · 1000 Bytes
/
Makefile
File metadata and controls
28 lines (21 loc) · 1000 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
TARGET = Hello
SRC_DIR = ./Source
OBJ_DIR = ./Object
LST_DIR = ./Listings
all: assemble link # run
assemble: # nasm -f elf64 -l $(TARGET).lst $(TARGET).s
nasm -f elf64 $(SRC_DIR)/asm_test.s -l $(LST_DIR)/asm_test.lst -o $(OBJ_DIR)/asm_test.o
nasm -f elf64 $(SRC_DIR)/_printf.s -l $(LST_DIR)/_printf.lst -o $(OBJ_DIR)/_printf.o
nasm -f elf64 $(SRC_DIR)/_string.s -l $(LST_DIR)/_string.lst -o $(OBJ_DIR)/_string.o
nasm -f elf64 $(SRC_DIR)/_nums.s -l $(LST_DIR)/_nums.lst -o $(OBJ_DIR)/_nums.o
gcc -S -masm=intel -Wno-format $(SRC_DIR)/c_test.c -o $(SRC_DIR)/c_test.s
link: # ld -s -o $(TARGET) $(TARGET).o
gcc -no-pie -s -Wno-format $(OBJ_DIR)/_nums.o $(OBJ_DIR)/_string.o $(OBJ_DIR)/_printf.o $(OBJ_DIR)/asm_test.o -o asm_test
gcc -c $(SRC_DIR)/c_test.c -Wno-format -o $(OBJ_DIR)/c_test.o
gcc -no-pie -s -Wno-format $(OBJ_DIR)/_string.o $(OBJ_DIR)/_nums.o $(OBJ_DIR)/_printf.o $(OBJ_DIR)/c_test.o -o c_test
run_c: # $(TARGET)
@./c_test
run_asm:
@./asm_test
clean:
@rm -f *.o *.lst