From 38129eb856720fc4c178413333527a992393fe6b Mon Sep 17 00:00:00 2001 From: William Brawner Date: Sun, 14 Jul 2024 20:34:07 -0600 Subject: [PATCH] Add meson.build and Makefile --- Makefile | 24 ++++++++++++++++++++++++ meson.build | 10 ++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Makefile create mode 100644 meson.build diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0a3aea2 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +C_FILES = $(wildcard src/*.c) +O_FILES = $(C_FILES:src/%.c=build/%.o) + +.PHONY: all clean +.DEFAULT: all + +all: pihelper + +libpihelper: $(O_FILES) + gcc -o $@ $^ + +pihelper: libpihelper + gcc -o $@ $^ + +build: + @mkdir -p build + +build/%.o: src/%.c | build + gcc -c $< -o $@ + +clean: + -rm -f $(O_FILES) + -rm -f pihelper + -rm -rf build diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..2847ea0 --- /dev/null +++ b/meson.build @@ -0,0 +1,10 @@ +project('pihelper', 'c') +crypto = dependency('libcrypto') +curl = dependency('libcurl') +jsonc = dependency('json-c') +ssl = dependency('libssl') +incdir = include_directories('include') +lib_dependencies = [ crypto, curl, ssl, jsonc ] +lib_sources = [ 'src/config.c', 'src/log.c', 'src/network.c', 'src/pihelper.c' ] +lib = library('pihelper', lib_sources, include_directories: incdir, dependencies: lib_dependencies) +executable('pihelper', ['src/cli.h', 'src/cli.c'], link_with: lib, include_directories: incdir)