-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.common
40 lines (30 loc) · 864 Bytes
/
Makefile.common
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
.DEFAULT_GOAL := all
TOP = $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
CROSS_COMPILE = m68k-elf-
CC = $(CROSS_COMPILE)gcc
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
OBJCOPY = $(CROSS_COMPILE)objcopy
ASFLAGS = --pcrel
CFLAGS = -mpcrel -fomit-frame-pointer -ffixed-a5 -ffixed-d7 -fshort-enums
CFLAGS += -Os -I"$(TOP)/os3k" -ffunction-sections -fdata-sections
LDFLAGS = -static -T "$(TOP)/os3k/os3k.lds" -L"$(TOP)/os3k" -los3k
LDFLAGS += --gc-sections
ARFLAGS = rcs
%.o : %.c $(*.h)
$(CC) $(CFLAGS) -c $<
%.o : %.asm $(*.inc)
$(AS) $(ASFLAGS) $< -o $@
%.a : $(OBJ)
$(AR) $(ARFLAGS) $@ $^
%.OS3KApp : $(OBJ)
$(LD) $^ $(LDFLAGS) -o $@
$(OBJCOPY) -O binary $@ $@
.PHONY: all clean $(SUBDIRS)
$(TARGET):
$(SUBDIRS):
+$(MAKE) -C $@ $(MAKECMDGOALS)
all:: $(TARGET) $(SUBDIRS)
clean: $(SUBDIRS)
rm -f $(INT) $(OBJ) $(TARGET)