Subversion Repositories Filer-Free

Rev

Rev 40 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

# 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 \
 -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