diff --git a/new_makefile.make b/new_makefile.make new file mode 100644 index 0000000000000000000000000000000000000000..c2b69a8420d62fa3f482bbb8781ba59ddf0cb295 --- /dev/null +++ b/new_makefile.make @@ -0,0 +1,65 @@ +# Makefile for Rapid Binary Star Evolution program + +# you will need to set the BINARY_C variable to point +# to the root binary_c directory + +# https://stackoverflow.com/questions/30573481/path-include-and-src-directory-makefile/30602701#30602701 +ifeq ($(BINARY_C),) + $(error BINARY_C is not set) +endif + +SRC_DIR := src +OBJ_DIR := obj +INC_DIR := inc +BIN_DIR := bin +TARGET_LIB_DIR := lib + +SRC_FILES := $(wildcard $(SRC_DIR)/binary_c_python_api.c) +OBJ_FILES := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES)) +DEP_FILES := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.d,$(SRC_FILES)) + +# https://latedev.wordpress.com/2014/12/02/generic-makefiles-with-gcc-and-gnu-make-part-2 + +# SRC = $(wildcard $(SRC_DIR)/binary_c_python_api.c) +# OBJECTS = $(C_SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o) + + +# + +CC := gcc +LD := gcc +MAKE := /usr/bin/make + +PROGRAM := binary_c_python_api + +LIBS := -lbinary_c $(shell $(BINARY_C)/binary_c-config --libs) + +# C_SRC := src/binary_c_python_api.c +C_SRC = $(wildcard $(SRC_DIR)/binary_c_python_api.c) +CFLAGS := -fPIC $(shell $(BINARY_C)/binary_c-config --flags | sed s/-fvisibility=hidden// ) -I$(BINARY_C)/src/ -I$(BINARY_C)/src/API -Iinclude + +OBJECTS := $(C_SRC:.c=.o) +OBJ_FLAGS := -c + +SO_FLAGS := -shared -o +SO_NAME := libbinary_c_api.so + +# To create python shared library +PY_EXEC := python3 +PY_SETUP := setup.py +PY_OPTIONS := build_ext --inplace + +# rules +.PHONY: all clean + +# all: $(PROGRAM) +all: $(OBJECTS) + $(CC) -DBINARY_C=$(BINARY_C) $(CFLAGS) $(INCDIRS) $(C_SRC) $(OBJ_FLAGS) $(INCDIRS) $(LIBS) + + # Make shared lib + $(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) $(SO_NAME) $(OBJECTS) + $(PY_EXEC) $(PY_SETUP) $(PY_OPTIONS) + +clean: + $(RM) *.o *.so + $(RM) build/ diff --git a/old_makefile.make b/old_makefile.make new file mode 100644 index 0000000000000000000000000000000000000000..536ef6199851d9cfdad6aafbb98f529862a50338 --- /dev/null +++ b/old_makefile.make @@ -0,0 +1 @@ +ding diff --git a/temp_makefile.make b/temp_makefile.make new file mode 100644 index 0000000000000000000000000000000000000000..4b25fb98ba986beaa60cf02f1ae864697b60f5cc --- /dev/null +++ b/temp_makefile.make @@ -0,0 +1,55 @@ +# 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 + +# Name of program +PROGRAM := binary_c_python_api + +# some commands +CC := gcc +LD := gcc +MAKE := /usr/bin/make + +# Libraries +LIBS := -lbinary_c $(shell $(BINARY_C)/binary_c-config --libs) + +# Source files and cflags +C_SRC := binary_c_python_api.c +CFLAGS := -fPIC $(shell $(BINARY_C)/binary_c-config --flags | sed s/-fvisibility=hidden// ) + +# Incdirs +INCDIRS := -I$(BINARY_C)/src/ -I$(BINARY_C)/src/API + +# Object files and flags +OBJECTS := $(C_SRC:.c=.o) +OBJ_FLAGS := -c + +# Shared lib files and flags +SO_NAME := libbinary_c_api.so +SO_FLAGS := -shared -o + +# To create python shared library +PY_EXEC := python3 +PY_SETUP := setup.py +PY_OPTIONS := build_ext --inplace + + +all: + $(CC) -DBINARY_C=$(BINARY_C) $(CFLAGS) $(INCDIRS) $(C_SRC) $(OBJ_FLAGS) $(LIBS) + #$(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) $(SO_NAME) $(OBJECTS) + #$(PY_EXEC) $(PY_SETUP) $(PY_OPTIONS) + +test: + @echo Objects: $(OBJECTS) + @echo Libs: $(LIBS) + @echo C_SRC: $(C_SRC) + @echo CFLAGS: $(CFLAGS) + @echo INCDIRS: $(INCDIRS) + +clean: + rm -f *.o *.so + rm -rf build/