Switched from standard makefile to cmake
This commit is contained in:
parent
03f712e583
commit
9399ff045d
5 changed files with 26 additions and 36 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,7 +1,6 @@
|
||||||
bastion
|
bastion
|
||||||
libssh/
|
build
|
||||||
id_rsa
|
id_rsa
|
||||||
ssh_host_*_key
|
ssh_host_*_key
|
||||||
test_client.c
|
test_client.c
|
||||||
*.[do]
|
|
||||||
*.sw[a-p]
|
*.sw[a-p]
|
||||||
|
|
14
CMakeLists.txt
Normal file
14
CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
cmake_minimum_required (VERSION 3.0)
|
||||||
|
project (bastion LANGUAGES C VERSION 0.1)
|
||||||
|
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE FALSE)
|
||||||
|
set(CMAKE_BUILD_TYPE DEBUG)
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "-Wall -Werror -Wextra -pedantic")
|
||||||
|
set(CMAKE_C_FLAGS_DEBUG "-g -ggdb -pg -fsanitize=address")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "-Os")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -g")
|
||||||
|
|
||||||
|
option(LIBSSH_VERBOSE_OUTPOUT "whether or not verbose output for libssh mode is activated" OFF)
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
32
GNUmakefile
32
GNUmakefile
|
@ -1,32 +0,0 @@
|
||||||
CC=clang
|
|
||||||
DEBUG=-g -fsanitize=address
|
|
||||||
CFLAGS= ${DEBUG} -Wall -Werror -Wextra -Weverything -Wno-disabled-macro-expansion
|
|
||||||
|
|
||||||
sources=$(wildcard src/*.c)
|
|
||||||
OBJ=$(sources:.c=.o)
|
|
||||||
|
|
||||||
all: bastion
|
|
||||||
|
|
||||||
bastion: $(OBJ)
|
|
||||||
$(CC) ${DEBUG} -o bastion $(OBJ) -lssh -lutil -ltty -lmysqlclient
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) bastion *.[do] src/*.[do]
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) -c $(CFLAGS) $*.c -o $*.o
|
|
||||||
$(CC) -MM $(CFLAGS) $*.c > $*.d
|
|
||||||
@mv -f $*.d $*.d.tmp
|
|
||||||
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
|
|
||||||
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
|
|
||||||
@rm -f $*.d.tmp
|
|
||||||
|
|
||||||
# You must compile without -fsanitize=address to use valgrind
|
|
||||||
valgrind:
|
|
||||||
valgrind --leak-check=full --show-leak-kinds=all --trace-children=yes --suppressions=${HOME}/.valgrind_suppressions ./bastion
|
|
||||||
#valgrind -v --leak-check=full --show-leak-kinds=all --trace-children=yes --suppressions=${HOME}/.valgrind_suppressions --gen-suppressions=yes ./bastion
|
|
||||||
|
|
||||||
debug:
|
|
||||||
ASAN_OPTIONS=allow_user_segv_handler=true:detect_leaks=true:fast_unwind_on_malloc=0:check_initialization_order=1:suppressions=asan.supp \
|
|
||||||
ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer \
|
|
||||||
./bastion
|
|
4
config.h
4
config.h
|
@ -9,8 +9,8 @@
|
||||||
#define RSAKEY_PATH "./ssh_host_rsa_key"
|
#define RSAKEY_PATH "./ssh_host_rsa_key"
|
||||||
#define ECDSAKEY_PATH "./ssh_host_ecdsa_key"
|
#define ECDSAKEY_PATH "./ssh_host_ecdsa_key"
|
||||||
|
|
||||||
#define MYSQL_HOST "::"
|
#define MYSQL_HOST "localhost"
|
||||||
#define MYSQL_USER "root"
|
#define MYSQL_USER "sshportal"
|
||||||
#define MYSQL_PASS "graou"
|
#define MYSQL_PASS "graou"
|
||||||
#define MYSQL_DB "sshportal"
|
#define MYSQL_DB "sshportal"
|
||||||
|
|
||||||
|
|
9
src/CMakeLists.txt
Normal file
9
src/CMakeLists.txt
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
include_directories("${bastion_SOURCE_DIR}/termrec/libtty/")
|
||||||
|
|
||||||
|
file(GLOB_RECURSE SOURCES *.c)
|
||||||
|
|
||||||
|
add_executable(bastion ${SOURCES})
|
||||||
|
add_library(libtty.a STATIC IMPORTED)
|
||||||
|
set_property(TARGET libtty.a PROPERTY IMPORTED_LOCATION "${bastion_SOURCE_DIR}/libtty.a")
|
||||||
|
target_link_libraries(bastion libtty.a)
|
||||||
|
target_link_libraries(bastion bz2 curl lzma mysqlclient pthread ssh z)
|
Reference in a new issue