support ancient toolchains
[ginge.git] / loader / Makefile
... / ...
CommitLineData
1ARCH ?= arm
2CROSS_COMPILE ?= arm-linux-
3CC = $(CROSS_COMPILE)gcc
4AS = $(CROSS_COMPILE)as
5CFLAGS += -Wall -ggdb -DLOADER
6LDFLAGS += -ggdb
7#LDFLAGS += -nodefaultlibs # NYET
8ifndef DEBUG
9CFLAGS += -O2 -fno-strict-aliasing
10LDFLAGS += -O2
11endif
12ifdef DBG
13CFLAGS += -DDBG=$(DBG)
14endif
15
16ifeq "$(ARCH)" "ia32"
17ARCH = ia32
18CFLAGS += -m32
19LDFLAGS += -m32
20endif
21ifeq "$(ARCH)" "arm"
22OBJ += syscalls.o emu_arm.o
23endif
24ifdef PND
25CFLAGS += -DPND
26TAG = _pnd
27endif
28ifdef WIZ
29CFLAGS += -DWIZ
30OBJ += wiz_video_arm.o
31TAG = _wiz
32endif
33
34vpath %.c = ../common/
35vpath %.s = ../common/
36
37TARGET_S = ginge_sloader$(TAG)
38TARGET_D = ginge_dyn$(TAG)
39
40OBJ += emu.o host.o host_fb.o cmn.o llibc.o
41OBJ_S += $(OBJ) loader.o loader_$(ARCH).o patches.o
42OBJ_D += $(OBJ) dl.o
43
44all: $(TARGET_S) $(TARGET_D)
45
46$(TARGET_S): LDFLAGS += -Wl,-T script_$(ARCH).lds
47$(TARGET_D): LDFLAGS += -ldl -Wl,--version-script=ginge_dyn.symver
48$(TARGET_D): LDFLAGS += -Wl,--no-undefined
49
50$(TARGET_S): $(OBJ_S)
51 $(CC) -o $@ $^ -static $(LDFLAGS)
52
53$(TARGET_D): $(OBJ_D)
54 $(CC) -o $@ $^ -shared $(LDFLAGS)
55
56# easier to support old toolchains with this
57%.o: %.s
58 $(CC) -o $@ -c $< $(CFLAGS)
59
60clean:
61 $(RM) $(TARGET_S) $(TARGET_D) $(OBJ_S) $(OBJ_D)
62
63# basic deps
64dl.o patches.o: override.c
65*.o: header.h
66host_fb.o: libpicofe/linux/fbdev.c