Newer
Older
# Makefile for Rapid Binary Star Evolution program
# you will need to set the BINARY_C variable to point
# to the root binary_c directory
ifeq ($(BINARY_C),)
$(error BINARY_C is not set)
endif
# TODO: Create the directories if they dont exist.
# Some directories
SRC_DIR := src
INC_DIR := include
OBJ_DIR := obj
TARGET_LIB_DIR := lib
CC := gcc
LD := gcc
MAKE := /usr/bin/make
LIBS := -lbinary_c $(shell $(BINARY_C)/binary_c-config --libs)
C_SRC := $(SRC_DIR)/binary_c_python_api.c
CFLAGS := -fPIC $(shell $(BINARY_C)/binary_c-config --flags | sed s/-fvisibility=hidden// )
INCDIRS := -I$(BINARY_C)/src/ -I$(BINARY_C)/src/API -I$(INC_DIR)/
OBJECTS := $(C_SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
OBJ_FLAGS := -c
SO_NAME := $(TARGET_LIB_DIR)/libbinary_c_api.so
SO_FLAGS := -shared
# To create python shared library
#PY_OPTIONS := build_ext --build-lib $(TARGET_LIB_DIR)
David Hendriks
committed
PY_OPTIONS := build_ext --inplace
$(CC) -DBINARY_C=$(BINARY_C) $(CFLAGS) $(INCDIRS) $(C_SRC) -o $(OBJECTS) $(OBJ_FLAGS) $(LIBS)
$(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS)
$(PY_EXEC) $(PY_SETUP) $(PY_OPTIONS)
@echo OBJECTS: $(OBJECTS)
@echo LIBS: $(LIBS)
@echo C_SRC: $(C_SRC)
@echo CFLAGS: $(CFLAGS)
@echo INCDIRS: $(INCDIRS)
clean:
$(RM) $(OBJ_DIR)/*.o $(TARGET_LIB_DIR)/*.so
David Hendriks
committed
$(RM) *.so