
C++FLAGS	= -fomit-frame-pointer -m68020 -Wall
CFLAGS		= -Wall
CPPFLAGS	= 
ARFLAGS		= -rsv
ECHO		= smakyecho

C++			= gcc
CC			= gcc
AR			= gcc_ar

C++SRCS	= $(wildcard *.cxx)
ASMSRCS	= $(wildcard *.s)
OBJS	= $(subst .cxx,.o,$(C++SRCS)) # $(subst .s,.o,$(ASMSRCS))
EXTOBJS	= lib/res.o lib/gra.o

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

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


all : def_monsel.code def_monsel.rs

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

def_monsel.rs : monsel.rs
	@-rm def_monsel.rs
	@#:cp monsel.rs def_monsel.rs

def_monsel.code : $(OBJS)
	@echo gcc is linking $@
	@gcc -o $@ $(OBJS) hldbox.a $(EXTOBJS) -lgxx -lc++ -lsmaky

clean:
	@$(ECHO) Cleaning up the object files
	@-rm -f make-c++.deps $(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

