Swap waf for a Makefile
This commit is contained in:
parent
6e26a3eed5
commit
f01f2777f7
19 changed files with 32 additions and 95 deletions
49
Makefile
49
Makefile
|
@ -1,19 +1,34 @@
|
|||
all:
|
||||
@waf build
|
||||
LIBS := \
|
||||
dbi \
|
||||
glib-2.0 \
|
||||
gmp \
|
||||
hogweed \
|
||||
nettle \
|
||||
talloc \
|
||||
tevent
|
||||
|
||||
CC := gcc
|
||||
CFLAGS := -O -g -ggdb -std=gnu99 -Wall -Wextra -Winit-self -Wformat-security -Wshadow -pedantic -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Werror-implicit-function-declaration -Wstrict-prototypes -fPIC -pie -fstack-protector -D_FORTIFY_SOURCE=2
|
||||
LDFLAGS := -fPIC -pie -z relro -z now -fstack-protector
|
||||
|
||||
SRCDIR=src
|
||||
BUILD=build
|
||||
|
||||
CFLAGS += $(shell pkg-config --cflags $(LIBS))
|
||||
LDFLAGS += $(shell pkg-config --libs $(LIBS))
|
||||
|
||||
$(BUILD)/%.o: $(SRCDIR)/%.c
|
||||
@echo [CC] $@
|
||||
@mkdir -p `dirname $@`
|
||||
@$(CC) -o $@ -c $< $(CFLAGS)
|
||||
|
||||
$(BUILD)/siahsd: $(patsubst %, $(BUILD)/%.o, siahsd database config status sia siahs jsonbot hook_script)
|
||||
@echo [LD] $@
|
||||
@$(CC) $(LDFLAGS) -o $@ $^
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(BUILD)/siahsd
|
||||
|
||||
clean:
|
||||
@waf clean
|
||||
|
||||
distclean:
|
||||
@waf distclean
|
||||
@rm tags
|
||||
|
||||
ctags:
|
||||
@ctags `find -name \*.[ch]`
|
||||
|
||||
coverity:
|
||||
@if [ -d cov-int ]; then rm -rf cov-int;fi
|
||||
@mkdir cov-int
|
||||
@cov-build --dir=cov-int waf configure clean build
|
||||
@tar cvzf coverity_siahsd.tgz cov-int
|
||||
@rm -rf cov-int
|
||||
@rm -rf $(BUILD)
|
||||
|
|
5
configure
vendored
5
configure
vendored
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# apt install libglib-dev libdbi-dev libtalloc-dev nettle-dev
|
||||
|
||||
waf configure
|
73
wscript
73
wscript
|
@ -1,73 +0,0 @@
|
|||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
def dist(ctx):
|
||||
ctx.base_name = 'siahsd'
|
||||
ctx.algo = 'tar.bz2'
|
||||
ctx.excl = ' **/.waf-1* **/*~ **/*.o **/*.swp **/.lock-w*'
|
||||
ctx.files = ctx.path.ant_glob('**/wscript')
|
||||
|
||||
def configure(conf):
|
||||
conf.env.CC = 'gcc'
|
||||
conf.load('gcc')
|
||||
|
||||
# Check for glib
|
||||
conf.check_cfg(package='glib-2.0', uselib_store='glib-2.0',
|
||||
args=['--cflags', '--libs'])
|
||||
|
||||
# Check for talloc
|
||||
conf.check_cfg(package='talloc', uselib_store='talloc',
|
||||
args=['--cflags', '--libs' ])
|
||||
|
||||
# Check for tevent
|
||||
conf.check_cfg(package='tevent', uselib_store='tevent',
|
||||
args=['--cflags', '--libs' ])
|
||||
|
||||
# Check for headers
|
||||
conf.check(header_name='stdio.h', features='c cprogram')
|
||||
conf.check(header_name='stdlib.h', features='c cprogram')
|
||||
conf.check(header_name='stdint.h', features='c cprogram')
|
||||
conf.check(header_name='stdbool.h', features='c cprogram')
|
||||
conf.check(header_name='sys/time.h', features='c cprogram')
|
||||
conf.check(header_name='sys/types.h', features='c cprogram')
|
||||
conf.check(header_name='sys/stat.h', features='c cprogram')
|
||||
conf.check(header_name='netinet/in.h', features='c cprogram')
|
||||
conf.check(header_name='arpa/inet.h', features='c cprogram')
|
||||
conf.check(header_name='unistd.h', features='c cprogram')
|
||||
conf.check(header_name='string.h', features='c cprogram')
|
||||
conf.check(header_name='fcntl.h', features='c cprogram')
|
||||
conf.check(header_name='errno.h', features='c cprogram')
|
||||
|
||||
# Used libraries
|
||||
conf.check(header_name='talloc.h', use='samba', features='c cprogram')
|
||||
conf.check(header_name='glib.h', use='glib-2.0', features='c cprogram')
|
||||
conf.check(header_name='dbi/dbi.h', features='c cprogram')
|
||||
|
||||
conf.check_cc(lib='dbi', uselib_store='dbi')
|
||||
conf.check_cc(lib='talloc', uselib_store='samba')
|
||||
conf.check_cc(lib='hogweed', uselib_store='nettle')
|
||||
conf.check_cc(lib='nettle', uselib_store='nettle')
|
||||
|
||||
# Purposefully at the bottom because waf configuration tests fail with -Wstrict-prototypes and -Werror
|
||||
conf.env.LDFLAGS = ['-fPIC', '-pie', '-z', 'relro', '-z', 'now', '-fstack-protector', '-L/usr/local/samba/lib']
|
||||
conf.env.CFLAGS = ['-O0', '-g', '-ggdb', '-std=gnu99', '-Wall', '-Wextra', '-Winit-self', '-Wformat-security','-Wshadow', '-pedantic',
|
||||
'-Wpointer-arith', '-Wcast-align', '-Wwrite-strings', '-Wno-unused-parameter',
|
||||
'-Werror-implicit-function-declaration', '-Wstrict-prototypes', '-fPIC', '-pie', '-fstack-protector',
|
||||
'-D_FORTIFY_SOURCE=2']
|
||||
|
||||
def build(bld):
|
||||
bld.stlib(source="database.c", target="database", use='glib-2.0')
|
||||
bld.stlib(source="status.c", target="status", use='glib-2.0')
|
||||
bld.stlib(source="hook_script.c", target="hook_script", use='glib-2.0')
|
||||
bld.stlib(source="config.c", target="config", use='glib-2.0 database jsonbot hook_script')
|
||||
bld.stlib(source="sia.c", target="sia", use='glib-2.0')
|
||||
bld.stlib(source="siahs.c", target="siahs", use='glib-2.0')
|
||||
bld.stlib(source="jsonbot.c", target="jsonbot", use='glib-2.0')
|
||||
|
||||
bld.program(
|
||||
source = 'siahsd.c',
|
||||
target = 'siahsd',
|
||||
use = [ 'database', 'config', 'status', 'sia', 'siahs', 'jsonbot', 'hook_script', 'dbi', 'talloc', 'glib-2.0', 'nettle' ])
|
||||
|
||||
def clean(ctx):
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue