File: Makefile.unit

package info (click to toggle)
libxlsxwriter 1.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,888 kB
  • sloc: ansic: 65,861; python: 2,106; makefile: 693; perl: 229; sh: 224; xml: 168; cpp: 73; javascript: 5
file content (65 lines) | stat: -rw-r--r-- 1,418 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
###############################################################################
#
# Makefile for libxlsxwriter library.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright 2014-2026, John McNamara, jmcnamara@cpan.org.
#

# Keep the output quiet by default.
Q=@
ifdef V
Q=
endif

# Directory variables.
INC_DIR        = ../../../include
LIB_DIR        = ../../../src

# Flags passed to the C compiler.
CFLAGS += -DTESTING -DCOLOR_OK -g -Wall -Wextra -Wno-unused-parameter $(GCOV)

# Make targets and objects.
SRCS  = $(wildcard test*.c)
TESTS = $(patsubst %.c,%,$(SRCS))
OBJS  = $(patsubst %.c,%.o,$(SRCS))

# Libs to link.
LIBS_A = $(LIB_DIR)/libxlsxwriter_test.a
LIBS_O = -lz
ifdef USE_SYSTEM_MINIZIP
LIBS_O += -lminizip
CFLAGS += -DUSE_SYSTEM_MINIZIP
endif

# Link libcrypto if needed.
ifdef USE_OPENSSL_MD5
LIBS_O += -lcrypto
endif

# Use a third party double number formatting function.
ifdef USE_DTOA_LIBRARY
CFLAGS += -DUSE_DTOA_LIBRARY
endif

# Make all the individual tests.
all : $(TESTS)

# Clean all the things!
clean :
	$(Q)rm -f $(TESTS) test_all *.o *.gcno *.gcda

# Build the testscases.
%.o: %.c
	$(Q)$(CC) -I$(INC_DIR) $(CFLAGS) -c $<

test_%: main.o test_%.o $(LIBS_A)
	$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS_O)

# Link all the tests into one test executable.
test_all : main.o $(OBJS) $(LIBS_A)
	$(Q)$(CC) $(CFLAGS) -o $@ $^ $(LIBS_O)

# Run the tests.
test : all test_all
	$(Q)./test_all