CC = @CC@
CXX = @CXX@
CPPFLAGS += @CPPFLAGS@
CFLAGS += @CFLAGS@ @WALL_FLAG@
CXXFLAGS += @CXXFLAGS@ @WALL_FLAG@
LDFLAGS += @LDFLAGS@

JAVAC = javac
JAVACFLAGS +=

OBJ = $(CSRC:.c=.o) $(JAVASRC:.java=.class) $(CCSRC:.cc=.o)

all: subdirs $(OBJ) $(BIN) $(LIB)

$(BIN): $(OBJ) $(EXTRA_LIBS)

$(EXTRA_LIBS): subdirs

$(LIB): $(OBJ)
	ar rc $(LIB) $(OBJ)
	ranlib $(LIB)

%.class: %.java
	$(JAVAC) $<

subdirs:
ifdef SUBDIRS
	for i in $(SUBDIRS); do $(MAKE) -C $$i; done
endif

clean:
ifdef SUBDIRS
	for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
endif
	rm -f *.o *.class *~ *.a $(BIN) $(LIB)

distclean: clean
ifdef SUBDIRS
	for i in $(SUBDIRS); do $(MAKE) -C $$i distclean; done
endif
	rm -f Makefile config.log config.status
