# Project: Angband 3.0.8+
#
# To use this makefile, the current working directory must be where
# this makefile is (if this makefile is at "raFS::Temp.$.ang.src.makefile",
# the CWD must be "raFS::Temp.$.ang.src").
#
# This makefile is for GNU make, but should work with either the Norcroft
# or GCC compilers. (Just change COMPILER to the correct value)

include Makefile.std

# Defaults
COMPILER = norcroft
default: standard

# The standard object files:
OBJS := $(BASEOBJS) main.o main-ros.o

# Borg object files:
BOBJS := borg1.o borg2.o borg3.o borg4.o borg5.o borg6.o borg7.o \
	borg8.o borg9.o


# Defaults for norcy
ifeq (norcroft, $(COMPILER))  
  # Tools:
  CC := cc 
  LD := link  
  RM := remove   

  # Libraries:
  LIBS := <CLibs$$Dir>.clib.o.StubsG <DeskLib$$Dir>.o.DeskLib

  CCFLAGS_BASIC := -apcs 3/32/fpe2/swst/fp/nofpr -throwback -c -Wan
endif

   
# Defaults for gcc
ifeq (gcc, $(COMPILER))
  WARNINGS := -ansi -pedantic -Wall -Wno-unused -Wno-long-long -W -Wcast-qual
       
  # Tools:
  CC := gcc -mlibscl -c
  LD := gcc -mlibscl   
  RM := remove

  # Libraries:
  LIBS := <DeskLib$$Dir>.o.DeskLib

  CCFLAGS_BASIC := -O2 $(WARNINGS) -mthrowback -mpoke-function-name
endif

main-ros.o: CCFLAGS += -DHAS_MY_STRCPY -DHAS_MY_STRCAT -DHAS_MY_STRNICMP -DBIGSCREEN=TRUE

#
# Rules to make the various targets
#
ALL_TARGETS := standard fullscreen borg

standard: CCFLAGS := $(CCFLAGS_BASIC)
standard: $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) -o !RunImage $(OBJS) $(LIBS)

fullscreen: CCFLAGS := -DFULLSCREEN_ONLY $(CCFLAGS_BASIC)  
fullscreen: $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) -o !RunImageF $(OBJS) $(LIBS)

borg: CCFLAGS := $(CCFLAGS_BASIC)
borg: $(OBJS) $(BOBJS) $(LIBS)
	$(LD) $(LDFLAGS) -o !RunImageB $(BOBJS) $(LIBS)

# Suffix rules
.SUFFIXES: .o .c

# A basic rule

%.o:%.c
	$(CC) $(CCFLAGS) -o $@ $<

# Dynamic dependencies:

