| 1 | ARCH ?= arm |
| 2 | CROSS_COMPILE ?= arm-linux- |
| 3 | CC = $(CROSS_COMPILE)gcc |
| 4 | AS = $(CROSS_COMPILE)as |
| 5 | CFLAGS += -Wall -ggdb -DLOADER |
| 6 | LDFLAGS += -ggdb |
| 7 | #LDFLAGS += -nodefaultlibs # NYET |
| 8 | ifndef DEBUG |
| 9 | CFLAGS += -O2 -fno-strict-aliasing |
| 10 | LDFLAGS += -O2 |
| 11 | endif |
| 12 | ifdef DBG |
| 13 | CFLAGS += -DDBG=$(DBG) |
| 14 | endif |
| 15 | |
| 16 | ifeq "$(ARCH)" "ia32" |
| 17 | ARCH = ia32 |
| 18 | CFLAGS += -m32 |
| 19 | LDFLAGS += -m32 |
| 20 | endif |
| 21 | ifeq "$(ARCH)" "arm" |
| 22 | OBJ += syscalls.o emu_arm.o |
| 23 | endif |
| 24 | ifdef PND |
| 25 | CFLAGS += -DPND |
| 26 | TAG = _pnd |
| 27 | endif |
| 28 | ifdef WIZ |
| 29 | CFLAGS += -DWIZ |
| 30 | OBJ += wiz_video_arm.o |
| 31 | TAG = _wiz |
| 32 | endif |
| 33 | |
| 34 | vpath %.c = ../common/ |
| 35 | vpath %.s = ../common/ |
| 36 | |
| 37 | TARGET_S = ginge_sloader$(TAG) |
| 38 | TARGET_D = ginge_dyn$(TAG) |
| 39 | |
| 40 | OBJ += emu.o host.o host_fb.o cmn.o llibc.o |
| 41 | OBJ_S += $(OBJ) loader.o loader_$(ARCH).o patches.o |
| 42 | OBJ_D += $(OBJ) dl.o |
| 43 | |
| 44 | all: $(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 | |
| 60 | clean: |
| 61 | $(RM) $(TARGET_S) $(TARGET_D) $(OBJ_S) $(OBJ_D) |
| 62 | |
| 63 | # basic deps |
| 64 | dl.o patches.o: override.c |
| 65 | *.o: header.h |
| 66 | host_fb.o: libpicofe/linux/fbdev.c |