Makefile 690 Bytes
Newer Older
1 2 3 4 5 6
ifeq ($(CC),gcc)
	LFLAGS = -fopenmp 
else
	LFLAGS = 
endif

Celine Mercier's avatar
Celine Mercier committed
7 8 9 10
SOURCE_DIR := src
ENV_DIR := $(abspath .)
OBJ_DIR := $(ENV_DIR)/obi_objdir
LIB_DIR := $(ENV_DIR)/obi_libdir
11

Celine Mercier's avatar
Celine Mercier committed
12
SOURCE_FILES = $(SOURCE_DIR)/libecoPCR/libapat/*.c $(SOURCE_DIR)/libecoPCR/libthermo/*.c $(SOURCE_DIR)/libecoPCR/*.c $(SOURCE_DIR)/libjson/*.c $(SOURCE_DIR)/*.c
13 14 15
OBJ_FILES = $(OBJ_DIR)/*.o
DYN_LIB_FILES = $(LIB_DIR)/libobi3.so

Celine Mercier's avatar
Celine Mercier committed
16
all: $(DYN_LIB_FILES)
17 18 19 20 21 22 23

$(LIB_DIR):
	mkdir -p $(LIB_DIR)

$(OBJ_DIR):
	mkdir -p $(OBJ_DIR)

Celine Mercier's avatar
Celine Mercier committed
24
$(DYN_LIB_FILES): $(OBJ_FILES) | $(LIB_DIR)
25 26
	$(CC) -shared -o $@ $^

Celine Mercier's avatar
Celine Mercier committed
27 28
$(OBJ_FILES): | $(OBJ_DIR)
	$(CC) $(LFLAGS) -fpic -c $(SOURCE_FILES)
29
	mv *.o $(OBJ_DIR)
Celine Mercier's avatar
Celine Mercier committed
30

31 32
clean:
	rm -rf $(LIB_DIR)
Celine Mercier's avatar
Celine Mercier committed
33
	rm -rf $(OBJ_DIR)