SIZE=		size
OBJCOPY=	objcopy

AR = ar
RANLIB = ranlib

COPTFLAGS?=-O 
INCLUDES= -I.

COPTS=	${INCLUDES}
CFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}

CFLAGS += -DALPINE

DEFINED_PROF=	${PROF}
ifdef PROF
CFLAGS+=	-malign-functions=4
#if ${PROFLEVEL} >= 2
#IDENT+=	-DGPROF4 -DGUPROF
#PROF+=	-mprofiler-epilogue
#endif
endif

# Put configuration-specific C flags last (except for ${PROF}) so that they
# can override the others.
CFLAGS+=	${CONF_CFLAGS}

.IMPSRC = $(filter %.c %.s, $^)
.TARGET = $@

NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC}
PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC}

SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
SYSTEM_OBJS= ${OBJS} \

BEFORE_DEPEND=

OBJS= native_syscalls.o req_resp.o

CFILES= native_syscalls.o req_resp.o

SFILES=
MFILES=
CLEAN=

.PHONY:	all modules

all: $(SYSTEM_OBJS)

ifneq ($(strip $(DEPEND_EXISTS)), yes)
${SYSTEM_OBJS}: $(filter %.h, ${BEFORE_DEPEND})
endif

clean:
	rm -f *.o *.a *.so *.So *.ko *.s eddep errs \
	      linterrs makelinks \
	      tags \
	      ${CLEAN}

#lint: /tmp
#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \
#	  $S/$M/$M/Locore.c ${CFILES} ioconf.c | \
#	    grep -v 'struct/union .* never defined' | \
#	    grep -v 'possible pointer alignment problem'

# This is a hack.  BFD "optimizes" away dynamic mode if there are no
# dynamic references.  We could probably do a '-Bforcedynamic' mode like
# in the a.out ld.  For now, this works.
hack.So: Makefile
	touch hack.c
	${CC} -shared -nostdlib hack.c -o hack.So
	rm -f hack.c

cleandepend:
	rm -f .depend

# Dependencies listed by hand. Ack !

native_syscalls.o: native_syscalls.c
	${NORMAL_C}
req_resp.o: req_resp.c
	${NORMAL_C}

# DO NOT DELETE THIS LINE -- make depend uses it
