ifdef DJDIR
EXEFMT = coff
else
EXEFMT = elf
endif

.SUFFIXES: .asm;

$(OUTFILE): $(OBJS)
	mld $(OUTFILE) $(OBJS) $(LIBS) $(LDFLAGS)

.c.o: 
	mgcc $*.c $*.o $(CFLAGS)

.cpp.o: 
	mgpp $*.cpp $*.o $(CPPFLAGS)

.cc.o: 
	mgpp $*.cc $*.o $(CPPFLAGS)

.asm.o:
	nasm $*.asm -f $(EXEFMT) -o $*.o

.s.o:
	cpp $*.s -o $*.asm -nostdinc -I/menuetos/include
	as $*.asm -o $*.o
	rm -f $*.asm

clean:
	rm -f $(OBJS) $(OUTFILE)

rebuild: clean $(OUTFILE)
