-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
40 lines (31 loc) · 911 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
TOPDIR := $(PWD)
DESTDIR :=
PREFIX := /usr/local
CROSS_COMPILE :=
CC := $(CROSS_COMPILE)gcc
OPT_CFLAGS := -Os
CPU_CFLAGS := -fno-asynchronous-unwind-tables -include $(TOPDIR)/nolibc.h
DEB_CFLAGS := -W -Wall -Wextra -g
DEF_CFLAGS :=
USR_CFLAGS :=
INC_CFLAGS :=
CFLAGS := $(OPT_CFLAGS) $(CPU_CFLAGS) $(DEB_CFLAGS) $(DEF_CFLAGS) $(USR_CFLAGS) $(INC_CFLAGS)
LD := $(CC)
DEB_LFLAGS := -g
USR_LFLAGS :=
LIB_LFLAGS := -lgcc
CPU_LFLAGS := -nostdlib -static
LDFLAGS := $(DEB_LFLAGS) $(USR_LFLAGS) $(CPU_LFLAGS)
STRIP := $(CROSS_COMPILE)strip
EXAMPLES := hello.stripped
OBJS :=
OBJS += hello.o
all: $(EXAMPLES)
$(EXAMPLES): %.stripped: %.bin
$(STRIP) -R .comment -o $@ $<
%.bin: %.o
$(LD) $(LDFLAGS) -o $@ $< $(LIB_LFLAGS)
%.o: %.c nolibc.h
$(CC) $(CFLAGS) -o $@ -c $<
clean:
-rm -f $(OBJS) $(EXAMPLES) *.bin *.stripped *.[oa] *~ */*.[oa] */*~ core a.out