150 lines
4.6 KiB
Makefile
150 lines
4.6 KiB
Makefile
#
|
|
# Makefile for 4.4 BSD, pic32 target
|
|
#
|
|
# This makefile is constructed from a machine description:
|
|
# config machineid
|
|
# Most changes should be made in the machine description
|
|
# /sys/conf/``machineid''
|
|
# after which you should do
|
|
# config machineid
|
|
# Machine generic makefile changes should be made in
|
|
# /sys/conf/Makefile.``machinetype''
|
|
# after which config should be rerun for all machines of that type.
|
|
#
|
|
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
|
|
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
|
|
#
|
|
# -DTRACE compile in kernel tracing hooks
|
|
# -DQUOTA compile in file system quotas
|
|
#
|
|
# DEBUG is set to -g by config if debugging is requested (config -g).
|
|
# PROF is set to -pg by config if profiling is requested (config -p).
|
|
|
|
.if exists(${MIPS_GCC_ROOT}/bin/mips-sde-elf-gcc)
|
|
MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-sde-elf-
|
|
.endif
|
|
.if exists(${MIPS_GCC_ROOT}/bin/mips-elf-gcc)
|
|
MIPS_GCC_PREFIX ?= ${MIPS_GCC_ROOT}/bin/mips-elf-
|
|
.endif
|
|
|
|
AS= ${MIPS_GCC_PREFIX}as ${DEBUG} -mips32r2 -EL
|
|
CC= ${MIPS_GCC_PREFIX}gcc ${DEBUG} -mips32r2 -EL -msoft-float -nostdinc -fno-builtin -Werror -Wall
|
|
CPP= ${MIPS_GCC_PREFIX}cpp
|
|
LD= ${MIPS_GCC_PREFIX}gcc -mips32r2 -EL
|
|
LDFLAGS= -nostdlib -T $A/${LDSCRIPT} -Wl,-Map=vmunix.map
|
|
SIZE= ${MIPS_GCC_PREFIX}size
|
|
OBJCOPY= ${MIPS_GCC_PREFIX}objcopy
|
|
OBJDUMP= ${MIPS_GCC_PREFIX}objdump
|
|
|
|
.if exists(${MIPS_GCC_ROOT}/bin/mips-elf-gcc)
|
|
LDFLAGS+= -Wl,--oformat=elf32-littlemips
|
|
.endif
|
|
|
|
# source tree is located via $S relative to the compilation directory
|
|
S= ../..
|
|
A= $S/mips
|
|
|
|
COPTS= -I. -I$S ${IDENT} -DKERNEL
|
|
CFLAGS= -O ${COPTS}
|
|
|
|
# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
|
|
# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
|
|
# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
|
|
# is marked as config-dependent.
|
|
|
|
NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
|
|
NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
|
|
|
|
DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
|
|
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
|
|
|
|
PROFILE_C= ${CC} -p -c ${COPTS} $<
|
|
|
|
NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@
|
|
NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
|
|
|
|
%OBJS
|
|
|
|
%CFILES
|
|
|
|
# load lines for config "xxx" will be emitted as:
|
|
# xxx: ${SYSTEM_DEP} swapxxx.o
|
|
# ${SYSTEM_LD_HEAD}
|
|
# ${SYSTEM_LD} swapxxx.o
|
|
# ${SYSTEM_LD_TAIL}
|
|
SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o vnode_if.o
|
|
SYSTEM_DEP= Makefile ${SYSTEM_OBJ} $S/libkern/libkern.a
|
|
SYSTEM_LD_HEAD= sh $S/conf/newvers.sh; ${CC} $(CFLAGS) -c vers.c; rm -f $@
|
|
SYSTEM_LD= -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -L$S/libkern -lkern -o vmunix.elf; \
|
|
${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -L$S/libkern -lkern -o vmunix.elf
|
|
SYSTEM_LD_TAIL= ${SIZE} vmunix.elf; \
|
|
$(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ vmunix.hex; \
|
|
$(OBJDUMP) -d -S vmunix.elf > vmunix.dis
|
|
|
|
%LOAD
|
|
|
|
$S/libkern/libkern.a:
|
|
cd $S/libkern && ${MAKE} all
|
|
|
|
clean:
|
|
rm -f eddep *vmunix.elf vmunix.gdb tags *.o locore.i [a-z]*.s \
|
|
Errs errs linterrs makelinks
|
|
|
|
lint: /tmp param.c
|
|
@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
|
|
$A/pic32/Locore.c ${CFILES} $A/pic32/swapgeneric.c \
|
|
ioconf.c param.c
|
|
|
|
symbols.sort: $A/pic32/symbols.raw
|
|
grep -v '^#' $A/pic32/symbols.raw \
|
|
| sed 's/^ //' | sort -u > symbols.sort
|
|
|
|
locore.o: $A/pic32/locore.s $A/include/machAsmDefs.h \
|
|
$A/include/machConst.h $A/include/reg.h $A/include/assym.h
|
|
${CPP} ${COPTS} ${PARAM} -DLOCORE $A/pic32/locore.s | \
|
|
${AS} -o locore.o
|
|
|
|
# the following is necessary because autoconf.o depends on #if GENERIC
|
|
autoconf.o: Makefile
|
|
|
|
# the following are necessary because the files depend on the types of
|
|
# cpu's included in the system configuration
|
|
clock.o machdep.o autoconf.o conf.o: Makefile
|
|
|
|
# depend on network configuration
|
|
uipc_proto.o vfs_conf.o: Makefile
|
|
|
|
machine:
|
|
ln -s $A/include $@
|
|
|
|
depend: machine param.c vnode_if.h
|
|
mkdep ${COPTS} ${CFILES} ioconf.c param.c
|
|
|
|
links:
|
|
egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
|
|
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
|
|
echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
|
|
sort -u | comm -23 - dontlink | \
|
|
sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
|
|
sh makelinks && rm -f dontlink
|
|
|
|
tags:
|
|
@echo "see $S/kern/Makefile for tags"
|
|
|
|
ioconf.o: ioconf.c
|
|
${CC} -c ${CFLAGS} ioconf.c
|
|
|
|
param.c: $S/conf/param.c
|
|
rm -f param.c
|
|
cp $S/conf/param.c .
|
|
|
|
param.o: param.c Makefile
|
|
${CC} -c ${CFLAGS} ${PARAM} param.c
|
|
|
|
vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
|
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
|
vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
|
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
|
|
|
%RULES
|