Revision 64 (by gdshaw@RISCPKG.ORG, 2007/05/21 05:44:33) Disabled exceptions and enabled optimisation to reduce code size.
# This file is part of the free Filer module for RISC OS.
# Copyright � 2007 Graham Shaw.
# Redistribution and modification are permitted within the terms of the
# GNU General Public License (version 2 or any later version).

AS = as
CXX = g++
LD = g++
CMHG = cmunge
FIXDEPS = fixdeps

CPPFLAGS = -IOSLib:
CXXFLAGS = -mthrowback -mlibscl -mmodule -fno-exceptions -Os \
 -Wall -W -Wno-unused -Wno-uninitialized -mpoke-function-name
ASFLAGS = -throwback -objasm -module -apcs32 -apcsfpv3 -target xscale -IOSLib:
LDFLAGS = -mlibscl -mmodule
CMHGFLAGS = -zoslib -zbase -tgcc -32bit

%.o: %.s
	$(AS) $(ASFLAGS) -o $@ $<

%.o: %.cc
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<

%.dd: %.cc
	$(CXX) -MM $(CPPFLAGS) $< > $@

%.d: %.dd
	$(FIXDEPS) $* < $< > $@

.DELETE_ON_ERROR:

SSRC = $(wildcard *.s)
CCSRC = $(wildcard *.cc)

.PHONY: all
all: Filer

.PHONY: clean
clean: always
	rm -f Filer
	rm -f $(wildcard *.o)
	rm -f header.h

.PHONY: always

Filer: $(SSRC:.s=.o) $(CCSRC:.cc=.o) header.o
	$(LD) $(LDFLAGS) -o $@ $^ OSLib:o.OSLib32

header.h header.o: header.cmhg Makefile
	$(CMHG) $(CMHGFLAGS) -d h.header -o o.header cmhg.header

$(SSRC:.s=.o) $(CCSRC:.cc=.o): Makefile
$(CCSRC:.cc=.dd): header.h

ifneq ($(MAKECMDGOALS),clean)
include $(CCSRC:.cc=.d)
endif