Skip to content

Commit 1917fba

Browse files
committed
Update the meson
1 parent a8e72ae commit 1917fba

2 files changed

Lines changed: 29 additions & 4 deletions

File tree

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ CFLAGS?=-O2 -Wall -Wextra -std=c99
33
DESTDIR?=
44
PREFIX?=/usr/local
55
BINDIR?=$(PREFIX)/bin
6+
AR?=ar
7+
RANLIB?=ranlib
8+
9+
OTEZIP_OBJS=src/lib/otezip.o
610

711
all: otezip
812

13+
libotezip.a: src/lib/otezip.o
14+
$(AR) rc $@ $(OTEZIP_OBJS)
15+
$(RANLIB) $@
16+
917
otezip: src/main.c src/lib/otezip.c src/include/otezip.h src/include/config.h
1018
$(CC) $(CFLAGS) -I src/include -o otezip src/main.c src/lib/otezip.c
1119

@@ -34,7 +42,11 @@ test2:
3442
rm -rf build
3543

3644
clean:
37-
rm -rf build otezip
45+
rm -rf build otezip libotezip.a $(OTEZIP_OBJS)
46+
47+
# Object file build rules
48+
src/lib/otezip.o: src/lib/otezip.c src/include/otezip.h src/include/config.h
49+
$(CC) $(CFLAGS) -I src/include -c src/lib/otezip.c -o $@
3850

3951
fmt indent:
4052
find . -name "*.c" -exec clang-format-radare2 -i {} \;

meson.build

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@ project('otezip', 'c',
22
version : '0.2.0',
33
default_options : ['c_std=c99', 'warning_level=2'])
44

5-
executable('otezip', 'src/main.c', 'src/lib/otezip.c',
6-
include_directories: include_directories('src/include'),
7-
install : true)
5+
otezip_src = files('src/lib/otezip.c')
6+
otezip_inc = include_directories('src/include')
7+
8+
otezip_lib = static_library('otezip',
9+
otezip_src,
10+
include_directories: otezip_inc,
11+
install: false
12+
)
13+
14+
otezip_dep = declare_dependency(
15+
link_with: otezip_lib,
16+
include_directories: otezip_inc
17+
)
18+
19+
# For subproject usage
20+
otezip_subproject = true

0 commit comments

Comments
 (0)