5.5.4. Sample Makefile - 5.2 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2025-12-29
Version
5.2 English

A sample Makefile file to integrate your application with AOCL-Compression library is shown here. Paths to include and lib folders in the installed AOCL-Compression installed package are provided and the application links to AOCL-Compression library.

# Set paths
AOCL_COMPRESSION_INSTALL_DIR := path/to/installed/package
AOCL_COMPRESSION_INC_DIR := $(AOCL_COMPRESSION_INSTALL_DIR)/include
AOCL_COMPRESSION_LIB_DIR := $(AOCL_COMPRESSION_INSTALL_DIR)/lib
lib_name := aocl_compression
exe_name := my_application

# Build application
my_sources := list of source files for the application
objects := $(my_sources:.c=.o) # Assuming .c source files, adjust as needed

# Compiler and linker flags
CXX := g++ # Or your preferred C++ compiler
CFLAGS := -I$(AOCL_COMPRESSION_INC_DIR)
LDFLAGS := -L$(AOCL_COMPRESSION_LIB_DIR) -l$(lib_name)

# Default target
all: $(exe_name)

# Rule to build the executable
$(exe_name): $(objects)
   $(CXX) $(LDFLAGS) -o $@ $^

# Rule to compile object files
%.o: %.c # Or %.cpp if you are using C++ source files
   $(CXX) $(CFLAGS) -c $< -o $@

# Clean target
clean:
   rm -f $(exe_name) $(objects)