2004-02-15 20:46:45 +00:00
|
|
|
#
|
|
|
|
#
|
2007-09-06 22:09:11 +00:00
|
|
|
# (c) 2004-2007 Laurent Vivier <Laurent@lvivier.info>
|
2004-02-15 20:46:45 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2005-09-19 19:08:55 +00:00
|
|
|
TARGET = m68k-linux
|
|
|
|
MEDIA = floppy
|
|
|
|
|
2004-12-01 00:21:04 +00:00
|
|
|
TOP = $(shell pwd)
|
|
|
|
VPATH = $(TOP)
|
2005-11-22 23:20:51 +00:00
|
|
|
CPPFLAGS = -DVERSION="\"$(VERSION)\"" -I$(TOP) -Wa,-I$(TOP) \
|
|
|
|
$(OPT_CPPFLAGS) -DUSE_CLI \
|
|
|
|
-I$(TOP)/../libmacos -Wa,-I$(TOP)/../libmacos \
|
2007-08-25 21:33:57 +00:00
|
|
|
-I$(TOP)/../libstream -I$(TOP)/../libui -I$(TOP)/../libconfig
|
2005-11-22 23:20:51 +00:00
|
|
|
|
2005-11-08 02:15:06 +00:00
|
|
|
# -O2 is needed to be able to inline functions from libmacos
|
|
|
|
CFLAGS = $(OPT_CFLAGS) -nostdlib -nodefaultlibs -Wall -Werror -Wno-multichar -fpic -O2
|
2004-03-04 22:47:46 +00:00
|
|
|
ASFLAGS =
|
2008-04-12 22:27:13 +00:00
|
|
|
LIBS = $(OPT_LIBS) \
|
|
|
|
-L$(TOP)/../libiso9660/m68k-linux -liso9660 \
|
|
|
|
-L$(TOP)/../libext2/m68k-linux -lext2 \
|
|
|
|
-L$(TOP)/../libunix -lunix \
|
2005-11-23 22:44:12 +00:00
|
|
|
-L$(TOP)/../libmacos -lmacos -lunix \
|
2005-11-22 23:20:51 +00:00
|
|
|
-L$(TOP)/../libgzip/m68k-linux -lgzip \
|
2005-11-23 22:44:12 +00:00
|
|
|
-L$(TOP)/../libfloppy -lfloppy -L$(TOP)/../libscsi -lscsi \
|
2005-12-01 22:16:34 +00:00
|
|
|
-L$(TOP)/../libblock -lblock \
|
2007-08-12 20:41:36 +00:00
|
|
|
-L$(TOP)/../libcontainer -lcontainer -lunix \
|
2007-08-25 21:33:57 +00:00
|
|
|
-L$(TOP)/../libui -lui \
|
2007-10-10 21:17:40 +00:00
|
|
|
-L$(TOP)/../libconfig/m68k-linux -lconfig -lunix \
|
|
|
|
-L$(TOP)/../libmap/m68k-linux -lmap
|
2005-11-22 23:20:51 +00:00
|
|
|
|
2004-05-11 23:02:18 +00:00
|
|
|
LS = ls
|
|
|
|
AWK = awk
|
2004-02-15 20:46:45 +00:00
|
|
|
|
2008-09-02 19:40:35 +00:00
|
|
|
HEADERS = arch.h bank.h bootenv.h bootinfo.h bootx.h console.h driver.h enter_kernel030.h enter_kernel040.h enter_kernel.h enter_kernelnoMMU.h switch_to_PPC.h head.h keyboard.h load.h misc.h MMU030.h MMU040.h serial.h vga.h config.h copymem.i cli.h
|
2004-12-01 00:21:04 +00:00
|
|
|
|
2005-11-08 02:15:06 +00:00
|
|
|
SOURCES = head.S main.c console.c \
|
2005-11-22 23:20:51 +00:00
|
|
|
font_8x16.c \
|
2005-11-08 02:15:06 +00:00
|
|
|
misc.c bank.c arch.c \
|
|
|
|
load.c serial.c vga.c driver.c \
|
2008-09-02 19:40:35 +00:00
|
|
|
enter_kernel.c config.c cli.c
|
2005-11-08 02:15:06 +00:00
|
|
|
|
2007-09-17 23:31:17 +00:00
|
|
|
SOURCES_CLI = keyboard.c
|
2005-11-08 02:15:06 +00:00
|
|
|
|
|
|
|
OBJS = $(patsubst %.c,%.o,$(SOURCES:.S=.o)) $(SOURCES_CLI:.c=.o) \
|
|
|
|
$(OPTOBJS)
|
2005-09-19 19:08:55 +00:00
|
|
|
|
|
|
|
# ARCHITECTURE
|
|
|
|
|
2009-06-08 20:37:03 +00:00
|
|
|
SOURCES_MMU030 = asm_MMU030.S MMU030.c enter_kernel030.S
|
|
|
|
SOURCES_MMU040 = asm_MMU040.S MMU040.c enter_kernel040.S
|
2005-12-01 13:52:01 +00:00
|
|
|
SOURCES_MMU = $(SOURCES_MMU030) $(SOURCES_MMU040)
|
|
|
|
SOURCES_noMMU = enter_kernelnoMMU.S
|
|
|
|
SOURCES_M68K = $(SOURCES_MMU) $(SOURCES_noMMU)
|
2005-09-19 19:08:55 +00:00
|
|
|
|
2005-12-01 13:52:01 +00:00
|
|
|
OBJS_M68K = $(patsubst %.c,%.o,$(SOURCES_M68K:.S=.o))
|
|
|
|
|
2007-02-02 22:12:48 +00:00
|
|
|
SOURCES_PPC = switch_to_PPC.S
|
2005-12-01 13:52:01 +00:00
|
|
|
|
|
|
|
OBJS_PPC = $(patsubst %.c,%.o,$(SOURCES_PPC:.S=.o))
|
2005-09-19 19:08:55 +00:00
|
|
|
|
|
|
|
# TARGET
|
|
|
|
|
2005-12-01 13:52:01 +00:00
|
|
|
SOURCES_LINUX_M68K = bootinfo.c
|
|
|
|
OBJS_LINUX_M68K = $(SOURCES_LINUX_M68K:.c=.o)
|
2005-09-19 19:08:55 +00:00
|
|
|
|
2005-12-01 13:52:01 +00:00
|
|
|
SOURCES_NETBSD_M68K = bootenv.c
|
|
|
|
OBJS_NETBSD_M68K = $(SOURCES_NETBSD_M68K:.c=.o)
|
2005-05-10 22:05:25 +00:00
|
|
|
|
2005-12-01 13:52:01 +00:00
|
|
|
SOURCES_LINUX_PPC = bootx.c
|
|
|
|
OBJS_LINUX_PPC = $(SOURCES_LINUX_PPC:.c=.o)
|
2005-09-19 19:08:55 +00:00
|
|
|
|
2005-12-01 13:52:01 +00:00
|
|
|
DISTFILES = $(SOURCES) $(SOURCES_M68K) $(SOURCES_PPC) $(SOURCES_CLI) $(SOURCES_LINUX_M68K) $(SOURCES_NETBSD_M68K) $(SOURCES_LINUX_PPC) $(HEADERS) Makefile ld.script
|
2005-09-19 19:08:55 +00:00
|
|
|
|
|
|
|
ifeq ("$(TARGET)", "m68k-linux")
|
|
|
|
|
|
|
|
OBJS_TARGET = $(OBJS_M68K) $(OBJS_LINUX_M68K)
|
2005-10-20 21:12:13 +00:00
|
|
|
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K -DUSE_MMU030 -DUSE_MMU040
|
2009-06-08 20:37:03 +00:00
|
|
|
CFLAGS_TARGET = -Os
|
2005-09-19 19:08:55 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
ifeq ("$(TARGET)", "classic-linux")
|
|
|
|
|
2005-10-20 21:12:13 +00:00
|
|
|
OBJS_TARGET = $(OBJS_noMMU) $(OBJS_LINUX_M68K)
|
2005-09-19 19:08:55 +00:00
|
|
|
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K
|
|
|
|
CFLAGS_TARGET = -m68000 -Wa,-m68000 -Os
|
2005-08-22 20:18:21 +00:00
|
|
|
|
2005-09-19 19:08:55 +00:00
|
|
|
else
|
|
|
|
ifeq ("$(TARGET)", "ppc-linux")
|
|
|
|
|
|
|
|
OBJS_TARGET = $(OBJS_PPC) $(OBJS_LINUX_PPC)
|
|
|
|
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_PPC
|
2009-06-08 20:37:03 +00:00
|
|
|
CFLAGS_TARGET = -Os
|
2005-09-19 19:08:55 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
ifeq ("$(TARGET)", "mixed-linux")
|
|
|
|
|
|
|
|
OBJS_TARGET = $(OBJS_M68K) $(OBJS_LINUX_M68K) $(OBJS_PPC) $(OBJS_LINUX_PPC)
|
2005-10-20 21:12:13 +00:00
|
|
|
CPPFLAGS_TARGET = -D__LINUX__ -DARCH_M68K -DUSE_MMU030 -DUSE_MMU040 -DARCH_PPC
|
2009-06-08 20:37:03 +00:00
|
|
|
CFLAGS_TARGET = -Os
|
2005-09-19 19:08:55 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
ifeq ("$(TARGET)", "m68k-netbsd")
|
|
|
|
|
|
|
|
OBJS_TARGET = $(OBJS_M68K) $(OBJS_NETBSD_M68K)
|
2005-10-20 21:12:13 +00:00
|
|
|
CPPFLAGS_TARGET = -D__NETBSD__ -DARCH_M68K -DUSE_MMU030 -DUSE_MMU040
|
2009-06-08 20:37:03 +00:00
|
|
|
CFLAGS_TARGET = -Os
|
2005-09-19 19:08:55 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2007-09-01 22:21:45 +00:00
|
|
|
LIBS_MEDIA=-L$(TOP)/../libstream/$(MEDIA) -lstream
|
2005-09-19 19:08:55 +00:00
|
|
|
|
2005-09-19 19:20:33 +00:00
|
|
|
$(TARGET)-$(MEDIA)/second::
|
2005-09-19 19:08:55 +00:00
|
|
|
test -d $(TARGET)-$(MEDIA) || mkdir $(TARGET)-$(MEDIA)
|
|
|
|
cd $(TARGET)-$(MEDIA) && make -f $(TOP)/Makefile second \
|
|
|
|
VERSION=$(VERSION) \
|
|
|
|
TOP=$(TOP) \
|
|
|
|
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
2007-02-02 22:12:48 +00:00
|
|
|
AS=$(AS) PPC_OBJCOPY=$(PPC_OBJCOPY) \
|
|
|
|
PPC_CC=$(PPC_CC) \
|
|
|
|
SIGNATURE="$(SIGNATURE)" \
|
2005-09-19 19:08:55 +00:00
|
|
|
OPT_CPPFLAGS="$(CPPFLAGS_TARGET) $(CPPFLAGS_MEDIA)" \
|
|
|
|
OPT_CFLAGS="$(CFLAGS_TARGET)" \
|
2005-11-26 09:01:36 +00:00
|
|
|
OPTOBJS="$(OBJS_TARGET) $(OBJS_MEDIA)" \
|
|
|
|
OPT_LIBS="$(LIBS_MEDIA)"
|
2007-02-02 22:12:48 +00:00
|
|
|
|
2008-08-12 09:24:22 +00:00
|
|
|
$(TARGET)-$(MEDIA)-driver/apple_driver::
|
|
|
|
test -d $(TARGET)-$(MEDIA)-driver || mkdir $(TARGET)-$(MEDIA)-driver
|
|
|
|
cd $(TARGET)-$(MEDIA)-driver && make -f $(TOP)/Makefile apple_driver \
|
|
|
|
VERSION=$(VERSION) \
|
|
|
|
TOP=$(TOP) \
|
|
|
|
OBJCOPY=$(OBJCOPY) LD=$(LD) CC=$(CC) \
|
|
|
|
AS=$(AS) PPC_OBJCOPY=$(PPC_OBJCOPY) \
|
|
|
|
PPC_CC=$(PPC_CC) \
|
|
|
|
SIGNATURE="$(SIGNATURE)" \
|
|
|
|
OPT_CPPFLAGS="-DAPPLE_DRIVER $(CPPFLAGS_TARGET) $(CPPFLAGS_MEDIA)" \
|
|
|
|
OPT_CFLAGS="$(CFLAGS_TARGET)" \
|
|
|
|
OPTOBJS="$(OBJS_TARGET) $(OBJS_MEDIA)" \
|
|
|
|
OPT_LIBS="$(LIBS_MEDIA)"
|
|
|
|
|
2007-02-02 22:12:48 +00:00
|
|
|
ifeq ("$(TARGET)", "ppc-linux")
|
|
|
|
bootstrapPPC.o: bootstrapPPC.S
|
|
|
|
$(PPC_CC) $(CPPFLAGS) -c $(TOP)/bootstrapPPC.S -o bootstrapPPC.o
|
2004-02-26 20:12:01 +00:00
|
|
|
|
2007-02-02 22:12:48 +00:00
|
|
|
bootstrap: bootstrapPPC.o
|
|
|
|
$(PPC_OBJCOPY) -j .text -j .data -j .rodata \
|
|
|
|
-O binary bootstrapPPC.o bootstrap
|
|
|
|
|
2007-02-02 22:27:58 +00:00
|
|
|
second: second.o
|
2007-02-02 22:12:48 +00:00
|
|
|
$(OBJCOPY) -j .text -j .data -j .rodata -j .got -j .bootstrap \
|
|
|
|
-O binary second.o second
|
|
|
|
|
2007-02-02 22:27:58 +00:00
|
|
|
second.o: $(OBJS) bootstrap $(TOP)/ld.script
|
2007-02-19 15:57:25 +00:00
|
|
|
$(OBJCOPY) -R .bootstrap switch_to_PPC.o
|
2007-02-17 22:39:07 +00:00
|
|
|
$(OBJCOPY) --add-section .bootstrap=bootstrap switch_to_PPC.o
|
2007-02-02 22:12:48 +00:00
|
|
|
$(LD) -T $(TOP)/ld.script -o second.o $(OBJS) $(LIBS)
|
|
|
|
|
|
|
|
else
|
2004-02-15 20:46:45 +00:00
|
|
|
second: second.o
|
2004-05-24 23:59:13 +00:00
|
|
|
$(OBJCOPY) -j .text -j .data -j .rodata -j .got \
|
2004-02-15 20:46:45 +00:00
|
|
|
-O binary second.o second
|
|
|
|
|
2004-12-01 00:21:04 +00:00
|
|
|
second.o: $(OBJS) $(TOP)/ld.script
|
2005-11-08 02:15:06 +00:00
|
|
|
$(LD) -T $(TOP)/ld.script -o second.o $(OBJS) $(LIBS)
|
2008-08-12 09:24:22 +00:00
|
|
|
|
|
|
|
apple_driver: apple_driver.o
|
|
|
|
$(OBJCOPY) -j .text -j .data -j .rodata -j .got \
|
|
|
|
-O binary apple_driver.o apple_driver
|
|
|
|
|
|
|
|
apple_driver.o: $(OBJS) $(TOP)/ld.script
|
|
|
|
$(LD) -T $(TOP)/ld.script -o apple_driver.o $(OBJS) $(LIBS)
|
|
|
|
|
2007-02-02 22:12:48 +00:00
|
|
|
endif
|
2007-02-02 20:13:11 +00:00
|
|
|
|
2004-02-15 20:46:45 +00:00
|
|
|
.c.o:
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^
|
|
|
|
|
2009-06-08 20:37:03 +00:00
|
|
|
%030.o: %030.S; $(CC) $(CPPFLAGS) $(CFLAGS) -m68030 -c -o $@ $^
|
|
|
|
%040.o: %040.S; $(CC) $(CPPFLAGS) $(CFLAGS) -m68040 -c -o $@ $^
|
|
|
|
|
2005-11-08 02:15:06 +00:00
|
|
|
install::
|
|
|
|
install -d $(DESTDIR)/$(PREFIX)/boot/emile/
|
|
|
|
install $(KARCH)-linux-scsi/second $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
|
|
|
|
install -d $(DESTDIR)/$(PREFIX)/lib/emile/
|
|
|
|
install $(KARCH)-linux-floppy/second $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
|
2008-08-13 12:29:52 +00:00
|
|
|
install m68k-linux-scsi-driver/apple_driver $(DESTDIR)/$(PREFIX)/lib/emile/apple_driver
|
2005-11-08 02:15:06 +00:00
|
|
|
|
|
|
|
uninstall::
|
|
|
|
rm -f $(DESTDIR)/$(PREFIX)/boot/emile/$(KARCH)-second_scsi
|
|
|
|
rm -f $(DESTDIR)/$(PREFIX)/lib/emile/$(KARCH)-second_floppy
|
2008-08-13 12:29:52 +00:00
|
|
|
rm -f $(DESTDIR)/$(PREFIX)/lib/emile/apple_driver
|
2005-11-08 02:15:06 +00:00
|
|
|
|
|
|
|
dist:
|
2005-12-01 13:52:01 +00:00
|
|
|
@echo TAR second
|
|
|
|
@for file in $(DISTFILES); do \
|
2005-11-08 02:15:06 +00:00
|
|
|
dir=$$(dirname $$file); \
|
|
|
|
if [ "$$dir" != "" ] ; then \
|
|
|
|
mkdir -p $(DISTDIR)/second/$$dir; \
|
|
|
|
fi; \
|
|
|
|
cp -p $$file $(DISTDIR)/second/$$file; \
|
|
|
|
done
|
|
|
|
|
2004-02-15 20:46:45 +00:00
|
|
|
clean:
|
2005-09-19 19:08:55 +00:00
|
|
|
rm -fr m68k-linux-floppy m68k-linux-scsi m68k-linux-ata \
|
|
|
|
ppc-linux-floppy ppc-linux-scsi ppc-linux-ata \
|
|
|
|
mixed-linux-floppy mixed-linux-scsi mixed-linux-ata \
|
2007-09-13 07:44:35 +00:00
|
|
|
m68k-netbsd-floppy classic-linux-floppy m68k-linux-full \
|
2008-08-12 09:24:22 +00:00
|
|
|
ppc-linux-full mixed-linux-full m68k-netbsd-full \
|
|
|
|
m68k-linux-scsi-driver
|
2007-09-06 22:09:11 +00:00
|
|
|
|
|
|
|
include $(TOP)/../tools.mk
|