#SYSTEMC=/users/outil/systemc/systemc-2.1.v1
#SYSTEMC=/users/cao/guillaumeb/Desktop/systemc-2.2.0
INCDIR=-I$(SYSTEMC)/include
LIBDIR=-L$(SYSTEMC)/lib-$(TARGET_ARCH)
LIBS=-lsystemc -lm $(EXTRA_LIBS)
EXE=$(MODULE).x

LBITS := $(shell getconf LONG_BIT)
ifeq ($(LBITS),64)
TARGET_ARCH=linux64
else
TARGET_ARCH=linux
endif


.SUFFIXES: .c .cc .cpp .o .x

$(EXE): $(OBJSPP) $(OBJS) $(SYSTEMC)/lib-$(TARGET_ARCH)/libsystemc.a
	ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ .
	$(CPP) $(CFLAGS) $(INCDIR) $(LIBDIR) $^ -o $@ 

.cpp.o:
	$(CPP) $(CFLAGS) $(INCDIR) -c $< -o $@

.cc.o:
	$(CPP) $(CFLAGS) $(INCDIR) -c $< -o $@

.c.o:
	$(CC) $(CFLAGS) $(INCDIR) -c $< -o $@

clean:
	rm -f $(OBJS) $(OBJSPP) *~ core

cleanall: clean
	rm -f Makefile.deps $(EXE)

Makefile.deps:
	$(CC) $(CFLAGS) $(INCDIR) -M $(SRCS) >> Makefile.deps

