Skip to content
Permalink
Browse files

moved OSQP build system from Makefile to Makefile.osqp

  • Loading branch information...
giaf committed Jan 16, 2019
1 parent 1ff9608 commit 57502e467f01c751f6312deb5e11457fe9d0126e
Showing with 91 additions and 92 deletions.
  1. +0 −92 Makefile
  2. +91 −0 Makefile.osqp
@@ -167,98 +167,6 @@ osqp_static: $(OSQP_LIB_STATIC)
cp -r $(OSQP_PATH)/include/* include/osqp/include
mv libosqp.a lib

# ==============================================================================
# OSQP make build system - START
# ==============================================================================

$(OSQP_LIB_STATIC): osqp_config $(OSQP_ALL_OBJ)
$(AR) rcs $@ $(OSQP_ALL_OBJ)

# compile all object files
$(OSQP_QDLDL_SRC_DIR)%.o: $(OSQP_QDLDL_SRC_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_QDLDL_INC_DIR) -c $< -o $@

$(OSQP_AMD_SRC_DIR)%.o: $(OSQP_AMD_SRC_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_AMD_INC_DIR) -I$(OSQP_INC_DIR) -c $< -o $@

$(OSQP_QDLDL_DIR)%.o: $(OSQP_QDLDL_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_QDLDL_DIR) -I$(OSQP_QDLDL_INC_DIR) -I$(OSQP_INC_DIR) -I$(OSQP_AMD_INC_DIR) -c $< -o $@

$(OSQP_PARDISO_DIR)%.o: $(OSQP_PARDISO_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_PARDISO_DIR) -I$(OSQP_INC_DIR) -I$(OSQP_LIN_SYS_DIR) -c $< -o $@

$(OSQP_LIN_SYS_DIR)%.o: $(OSQP_LIN_SYS_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_LIN_SYS_DIR) -I$(OSQP_INC_DIR) -I$(OSQP_QDLDL_INC_DIR) -c $< -o $@

$(OSQP_SRC_DIR)%.o: $(OSQP_SRC_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_INC_DIR) -I$(OSQP_QDLDL_DIR) -I$(OSQP_QDLDL_INC_DIR) -I$(OSQP_PARDISO_DIR) -c $< -o $@

osqp_config:
@touch $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "#ifndef QDLDL_TYPES_H" > $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# define QDLDL_TYPES_H" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# ifdef __cplusplus" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "extern "C" {" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "// QDLDL integer and float types" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
ifeq ($(OSQP_DLONG), 1)
@echo "typedef long long QDLDL_int; /* for indices */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
else
@echo "typedef int QDLDL_int; /* for indices */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
endif
ifeq ($(OSQP_DFLOAT), 1)
@echo "typedef float QDLDL_float; /* for numerical values */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
else
@echo "typedef double QDLDL_float; /* for numerical values */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
endif
@echo "typedef unsigned char QDLDL_bool; /* for boolean values */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# ifdef __cplusplus" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "}" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "#endif /* ifndef QDLDL_TYPES_H */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@touch $(OSQP_INC_DIR)osqp_configure.h
@echo "#ifndef OSQP_CONFIGURE_H" > $(OSQP_INC_DIR)osqp_configure.h
@echo "# define OSQP_CONFIGURE_H" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "# ifdef __cplusplus" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "extern "C" {" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "/* Operative system */" >> $(OSQP_INC_DIR)osqp_configure.h
ifeq ($(OS), LINUX)
@echo "#define IS_LINUX" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OS), MAC)
@echo "#define IS_MAC" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OS), WINDOWS)
@echo "#define IS_WINDOWS" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OSQP_PRINTING), 1)
@echo "/* PRINTING */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#define PRINTING" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OSQP_DLONG), 1)
@echo "/* DLONG */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#define DLONG" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OSQP_ENABLE_MKL_PARDISO),1)
@echo "/* ENABLE_MKL_PARDISO */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#define ENABLE_MKL_PARDISO" >> $(OSQP_INC_DIR)osqp_configure.h
endif
@echo "# ifdef __cplusplus" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "}" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#endif /* ifndef OSQP_CONFIGURE_H */" >> $(OSQP_INC_DIR)osqp_configure.h

# ==============================================================================
# OSQP make build system - END
# ==============================================================================

acados_c_static: acados_static
ifeq ($(ACADOS_WITH_C_INTERFACE), 1)
( cd interfaces/acados_c; $(MAKE) static_library CC=$(CC) TOP=$(TOP) )
@@ -78,3 +78,94 @@ OSQP_OBJ = $(OSQP_SRC_DIR)auxil.o \
$(OSQP_SRC_DIR)util.o \

OSQP_ALL_OBJ = $(OSQP_QDLDL_OBJ) $(OSQP_AMD_OBJ) $(OSQP_QDLDL_INTERFACE_OBJ) $(OSQP_PARDISO_OBJ) $(OSQP_LIN_SYS_OBJ) $(OSQP_OBJ)



# ==============================================================================
# OSQP make build system
# ==============================================================================

$(OSQP_LIB_STATIC): osqp_config $(OSQP_ALL_OBJ)
$(AR) rcs $@ $(OSQP_ALL_OBJ)

# compile all object files
$(OSQP_QDLDL_SRC_DIR)%.o: $(OSQP_QDLDL_SRC_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_QDLDL_INC_DIR) -c $< -o $@

$(OSQP_AMD_SRC_DIR)%.o: $(OSQP_AMD_SRC_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_AMD_INC_DIR) -I$(OSQP_INC_DIR) -c $< -o $@

$(OSQP_QDLDL_DIR)%.o: $(OSQP_QDLDL_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_QDLDL_DIR) -I$(OSQP_QDLDL_INC_DIR) -I$(OSQP_INC_DIR) -I$(OSQP_AMD_INC_DIR) -c $< -o $@

$(OSQP_PARDISO_DIR)%.o: $(OSQP_PARDISO_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_PARDISO_DIR) -I$(OSQP_INC_DIR) -I$(OSQP_LIN_SYS_DIR) -c $< -o $@

$(OSQP_LIN_SYS_DIR)%.o: $(OSQP_LIN_SYS_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_LIN_SYS_DIR) -I$(OSQP_INC_DIR) -I$(OSQP_QDLDL_INC_DIR) -c $< -o $@

$(OSQP_SRC_DIR)%.o: $(OSQP_SRC_DIR)%.c
@echo "Compiling object file" $@
@$(CC) $(OSQP_CFLAGS) -I$(OSQP_INC_DIR) -I$(OSQP_QDLDL_DIR) -I$(OSQP_QDLDL_INC_DIR) -I$(OSQP_PARDISO_DIR) -c $< -o $@

osqp_config:
@touch $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "#ifndef QDLDL_TYPES_H" > $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# define QDLDL_TYPES_H" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# ifdef __cplusplus" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "extern "C" {" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "// QDLDL integer and float types" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
ifeq ($(OSQP_DLONG), 1)
@echo "typedef long long QDLDL_int; /* for indices */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
else
@echo "typedef int QDLDL_int; /* for indices */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
endif
ifeq ($(OSQP_DFLOAT), 1)
@echo "typedef float QDLDL_float; /* for numerical values */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
else
@echo "typedef double QDLDL_float; /* for numerical values */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
endif
@echo "typedef unsigned char QDLDL_bool; /* for boolean values */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# ifdef __cplusplus" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "}" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@echo "#endif /* ifndef QDLDL_TYPES_H */" >> $(OSQP_QDLDL_INC_DIR)qdldl_types.h
@touch $(OSQP_INC_DIR)osqp_configure.h
@echo "#ifndef OSQP_CONFIGURE_H" > $(OSQP_INC_DIR)osqp_configure.h
@echo "# define OSQP_CONFIGURE_H" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "# ifdef __cplusplus" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "extern "C" {" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "/* Operative system */" >> $(OSQP_INC_DIR)osqp_configure.h
ifeq ($(OS), LINUX)
@echo "#define IS_LINUX" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OS), MAC)
@echo "#define IS_MAC" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OS), WINDOWS)
@echo "#define IS_WINDOWS" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OSQP_PRINTING), 1)
@echo "/* PRINTING */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#define PRINTING" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OSQP_DLONG), 1)
@echo "/* DLONG */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#define DLONG" >> $(OSQP_INC_DIR)osqp_configure.h
endif
ifeq ($(OSQP_ENABLE_MKL_PARDISO),1)
@echo "/* ENABLE_MKL_PARDISO */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#define ENABLE_MKL_PARDISO" >> $(OSQP_INC_DIR)osqp_configure.h
endif
@echo "# ifdef __cplusplus" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "}" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "# endif /* ifdef __cplusplus */" >> $(OSQP_INC_DIR)osqp_configure.h
@echo "#endif /* ifndef OSQP_CONFIGURE_H */" >> $(OSQP_INC_DIR)osqp_configure.h

0 comments on commit 57502e4

Please sign in to comment.
You can’t perform that action at this time.