# 
# Mach Operating System
# Copyright (c) 1994 Johannes Helander
# Copyright (c) 1994, The University of Utah and
# the Computer Systems Laboratory at the University of Utah (CSL).
# All Rights Reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# JOHANNES HELANDER AND THE UNIVERSITY OF UTAH AND CSL ALLOWS FREE
# USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  JOHANNES HELANDER
# AND THE UNIVERSITY OF UTAH AND CSL DISCLAIMS ANY LIABILITY OF ANY
# KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
# SOFTWARE.
# 

# This file contains i386-specific make rules for all of Lites.
#
# SRCDIR must be set to the directory of the i386 source tree.
# SECTIONS must be set to any optional sections to activate.
# (The current directory is assumed to be the object directory.)


# Get rid.
DEFINES += -Dmips -DPMAX

# Required compiler/assembler flags.
# Note that we don't have to bother with HOST_anything
# for assembly language sources:
# the host probably can't execute i386 assembly language anyway.
TARGET_ASFLAGS	+= -DASSEMBLER -Wa,-nocpp
TARGET_LDFLAGS	+= -e __start -G 32 -EL
TARGET_CFLAGS	+= -EL -G 32

# The generic source tree doesn't know about assembly language,
# so we work it out here.
# The SRCDIRS variable isn't complete yet
# (it doesn't have the generic directories in it),
# but that's no problem because we know there's no assembly language
# in the generic directories anyway.
ifdef COLLECT_SFILES
SFILES += $(filter %.s,$(FILES))
endif

GEN_OBJFILES += $(sort $(addsuffix .o,$(basename $(notdir $(SFILES)))))


%.o: %.s 
	@echo
	$(TARGET_CC) -x assembler-with-cpp -c $(CPPFLAGS) $(ASFLAGS) $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) -MD $<

%_p.o: %.s
	@echo
	$(TARGET_CC) -x assembler-with-cpp -pg -DGPROF -c $(CPPFLAGS) $(ASFLAGS) $(TARGET_CPPFLAGS) $(TARGET_ASFLAGS) -MD $< -o $@


