Skip to content

Commit

Permalink
Rework build structure to be more sane
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Nov 21, 2011
1 parent daa861b commit 48aa9f8
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 82 deletions.
86 changes: 86 additions & 0 deletions encryption_package/Makefile
@@ -0,0 +1,86 @@
############################
# Vertica Analytic Database
#
# Makefile to build package directory
#
# Copyright 2011 Vertica Systems, an HP Company
############################

ifdef RUN_VALGRIND
VALGRIND=valgrind --leak-check=full
endif

SDK?=/opt/vertica/sdk
VSQL?=vsql

VERTICA_SDK_INCLUDE = $(SDK)/include
SIMULATOR_PATH = $(SDK)/simulator
DEBUG_DATA_PATH = $(shell pwd)/test-data



THIRD_PARTY = $(shell pwd)/src/third-party
THIRD_PARTY_INCLUDE = $(THIRD_PARTY)/include


# Required object files
BUILD_FILES = build/Vertica.o \
$(addprefix build/,rijndael.o my_aes.o) \
$(addprefix build/,AESEncrypt.o AESDecrypt.o)

PACKAGE_LIBNAME = build/Encryption.so

CXX=g++
CXXFLAGS=-D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I $(VERTICA_SDK_INCLUDE) -I $(THIRD_PARTY_INCLUDE)
LDFLAGS=-shared

# add optimization if not a debug build
ifndef DEBUG
CXXFLAGS+= -O3 -DNDEBUG
CFLAGS+= -O3 -DNDEBUG
endif

export PATH := $(THIRD_PARTY_LIB):$(PATH)

.PHONEY: $(PACKAGE_LIBNAME)

all: $(PACKAGE_LIBNAME)

# build package functions
$(PACKAGE_LIBNAME): $(BUILD_FILES)
mkdir -p build
$(CXX) $(LDFLAGS) -o $@ $(BUILD_FILES)

# rule to make build/XXX.so from src/XXX.so
build/%.o: src/%.cpp
@mkdir -p build
$(CXX) $(CXXFLAGS) $< -o $@

build/Vertica.o: $(VERTICA_SDK_INCLUDE)/Vertica.cpp
@mkdir -p build
$(CXX) $(CXXFLAGS) $(VERTICA_SDK_INCLUDE)/Vertica.cpp -o $@

# rule to make build/XX.o from third-party/src/*.c
build/%.o: $(THIRD_PARTY)/src/%.c
@mkdir -p build
$(CXX) $(CXXFLAGS) $< -o $@

install: $(PACKAGE_LIBNAME) ddl/install.sql
$(VSQL) -f ddl/install.sql
uninstall: ddl/uninstall.sql
$(VSQL) -f ddl/uninstall.sql


# Run the simulator against the functons
sim_test: all simulator
$(VALGRIND) ./vsim $(PACKAGE_LIBNAME) FunctionName $(DEBUG_DATA_PATH)/testdata.txt

# build the simulator (in SIMULATOR_PATH) and simlink it here
simulator:
$(MAKE) -C $(SIMULATOR_PATH)
ln -f -s $(SIMULATOR_PATH)/vsim

clean:
rm -rf build
rm -f vsim*

3 changes: 1 addition & 2 deletions encryption_package/README.txt
Expand Up @@ -2,8 +2,7 @@
INTRODUCTION
-------------------------------

This package is meant to be the beginnings of a library containing
encryption functions for Vertica.
This package contains encryption functions for Vertica.

To that end, my contribution consists of a pair of AES
encryption/decryption functions. This enables field-level encryption
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
80 changes: 0 additions & 80 deletions encryption_package/src/Makefile

This file was deleted.

0 comments on commit 48aa9f8

Please sign in to comment.