Skip to content
Snippets Groups Projects
Select Git revision
  • 8fea983b7ef65620b009bc7d8fd67d3399100128
  • master default protected
  • development_0.9.5/2.2.2_post_merge_david_branch
  • dhendriks/versions/0.9.5/2.2.2_post_merge
  • feature/MC_sampling
  • push_test
  • development_0.9.5/2.2.2
  • fix/new_mac_fix
  • development_0.9.3/2.2.1_pre-merge
  • dhendriks/versions/0.9.3/2.2.1_pre_merge
  • development_0.9.4/2.2.1
  • development_0.9.5/2.2.1
  • development_0.9.3/2.2.1
  • papers/JOSS_release
  • feature/binary_c_ensemble_manager_implementation
  • feature/HPC
  • development_0.9.2/2.2.1
  • development_0.9.2/2.2.0
  • auto_resolution
  • feature/generate_docs_script
  • feature/custom_system_generator_endpoint
  • 0.9.1
  • v2.2.0
  • archive/queue_solution
  • archive/capsules
  • archive/gitlab_pages
  • 0.3.1
  • 0.3
  • archive/population
  • archive/david_branch
  • archive/black_formatting
  • 2.1.6
  • archive/help_function
  • 0.21
  • 0.2
  • archive/restructure_module
  • 2.1.5
  • archive/readthedocs
  • archive/better_makefile
  • archive/src_location
  • 2.1.4
41 results

Makefile

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Makefile 2.07 KiB
    # 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.
    
    
    # Name of program
    PROGRAM 			:= binary_c_python_api
    
    # Some directories
    SRC_DIR 			:= src
    INC_DIR 			:= include
    OBJ_DIR 			:= obj
    TARGET_LIB_DIR 		:= lib
    
    # some commands
    CC      			:= gcc
    LD      			:= gcc
    MAKE    			:= /usr/bin/make
    MKDIR_P 			:= mkdir -p
    PWD 				:= pwd
    
    # Libraries
    LIBS 				:= -lbinary_c $(shell $(BINARY_C)/binary_c-config --libs)
    
    # Source files and cflags
    C_SRC 				:= $(SRC_DIR)/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 -I$(INC_DIR)/
    
    # Object files and flags
    OBJECTS 			:= $(C_SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
    OBJ_FLAGS 			:= -c
    
    # Shared lib files and flags
    SO_NAME 			:= $(TARGET_LIB_DIR)/libbinary_c_python_api.so
    SO_FLAGS 			:= -shared
    SO_NAME_EXTRA 		:= binarycpython/libbinary_c_python_api.so
    
    all: create_directories create_objects create_library
    
    debug: create_directories create_objects_debug create_library_debug
    
    create_directories:
    	${MKDIR_P} ${TARGET_LIB_DIR}
    	${MKDIR_P} ${OBJ_DIR}
    
    create_objects:
    	$(CC) -DBINARY_C=$(BINARY_C) $(CFLAGS) $(INCDIRS) $(C_SRC) -o $(OBJECTS) $(OBJ_FLAGS) $(LIBS) 
    
    create_objects_debug: 
    	$(CC) -DBINARY_C=$(BINARY_C) -DBINARY_C_PYTHON_DEBUG $(CFLAGS) $(INCDIRS) $(C_SRC) -o $(OBJECTS) $(OBJ_FLAGS) $(LIBS) 
    
    create_library:
    	@echo $(PWD)
    	$(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS)
    	$(CC) -DBINARY_C=$(BINARY_C) $(SO_FLAGS) -o $(SO_NAME_EXTRA) $(OBJECTS)
    
    create_library_debug:
    	$(CC) -DBINARY_C=$(BINARY_C) -DBINARY_C_PYTHON_DEBUG $(SO_FLAGS) -o $(SO_NAME) $(OBJECTS)
    
    echo_vars:	
    	@echo OBJECTS: $(OBJECTS)
    	@echo LIBS: $(LIBS)
    	@echo C_SRC: $(C_SRC)
    	@echo CFLAGS: $(CFLAGS)
    	@echo INCDIRS: $(INCDIRS)
    	@echo SO_NAME: $(SO_NAME)
    
    clean:
    	$(RM) $(OBJ_DIR)/*.o $(TARGET_LIB_DIR)/*.so
    	$(RM) *.o
    	$(RM) *.so
    	$(RM) -r build/