-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (30 loc) · 767 Bytes
/
Makefile
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
42
#
# Makefile for kread
#
EXEC=kread
# find .c file under the current dir
C_SOURCES = $(shell find . -path "./.si" -prune -o -name "*.c" -print)
C_OBJECTS = $(patsubst %.c,%.o,$(C_SOURCES))
# find .asm file under the current dir
S_SOURCES = $(shell find . -name "*.asm")
S_OBJECTS = $(patsubst %.asm,%.o,$(S_SOURCES))
CC = gcc
ASM = nasm
LD = ld
OBJCOPY = objcopy
C_FLAGS = -c -ggdb -fno-stack-protector -I include
LD_FLAGS = -rdynamic
.c.o:
@echo $(C_SOURCES)
$(CC) $(C_FLAGS) $< -o $@
$(EXEC) : $(C_OBJECTS)
$(CC) $(LD_FLAGS) $(S_OBJECTS) $(C_OBJECTS) -o $(EXEC)
.PHONY: all clean install uninstall
all:
@echo "build $(EXEC)"
install:
install $(EXEC) /usr/local/bin/
uninstall:
rm -rf /usr/local/bin/$(EXEC)
clean :
rm -f $(EXEC) $(C_OBJECTS)