
LIB		= libregistry.a
EXT		= cxx

C++SRCS		= $(wildcard *.$(EXT))
C++OBJS		= $(subst .$(EXT),.o,$(C++SRCS))

ECHO		= smakyecho

C++FLAGS	= -Wall -m68020 -fomit-frame-pointer -O2
C++			= gcc

%.o : %.$(EXT)
	@echo gcc is compiling $<
	@$(C++) -x c++ -c $(C++FLAGS) $(CPPFLAGS) $< -o $@

%.asm : %.$(EXT)
	@echo gcc is compiling $< for assembler source only
	@$(C++) -x c++ -S $(C++FLAGS) $(CPPFLAGS) $< -o $@


all: $(LIB)
	cd C_LIB:; make all; cd ..:

objects: $(LIB)

$(LIB): $(C++OBJS)
	gcc_ar -rs $(LIB) $(C++OBJS)

deps:
	@$(ECHO) Making dependencies for the C++ sources
	@$(C++) -x c++ -M $(CPPFLAGS) $(C++SRCS) > make-c++.deps

clean:
	@$(ECHO) Cleaning up the object files
	@-rm -f make-c++.deps $(C++OBJS) $(wildcard *.a)

.PHONY : all deps clean

#  Include the dependency file if it does exist. If not, the result will
#  be unpredictable. This is just a trick to be able to `make deps'.

ifeq ("$(wildcard make-c++.deps)", "make-c++.deps ")
include make-c++.deps
endif


