LIBS=		-lpthread -lz -lm -L${HOME}/papi-install/lib -lpapi
CC=			gcc
CFLAGS=		-g -Wall -Wextra -Wc++-compat -O0
INCLUDES=	-I. -I${HOME}/papi-install/include


# The target binary program
TARGET=		papi_test

# The source files
SRCS=		papi_test.c

# The object files
OBJS=		$(SRCS:.c=.o)

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

all: $(TARGET) shared chmode

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

shared: $(OBJS)
	$(CC) $(CFLAGS) $(INCLUDES) -shared -o papi_test.so -fPIC $(SRCS) $(LIBS)

chmode:
	chmod 777 papi_test.so

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