File: Makefile

package info (click to toggle)
boxes 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,800 kB
  • sloc: ansic: 10,566; lex: 517; sh: 503; makefile: 309; yacc: 272; lisp: 78
file content (78 lines) | stat: -rw-r--r-- 3,784 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
66
67
68
69
70
71
72
73
74
75
76
77
78
#
# boxes - Command line filter to draw/remove ASCII boxes around text
# Copyright (c) 1999-2024 Thomas Jensen and the boxes contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
# License, version 3, as published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#____________________________________________________________________________________________________________________
#====================================================================================================================

CC         = gcc

OUT_DIR    = ../out
SRC_DIR    = ../src
UTEST_DIR  = ../utest
VPATH      = $(SRC_DIR):$(SRC_DIR)/misc:$(UTEST_DIR)

UTEST_NORM = global_mock.c bxstring_test.o cmdline_test.c logging_test.c tools_test.c regulex_test.o remove_test.o \
             main.o unicode_test.o utest_tools.o

.PHONY: check_dir flags_unix flags_win32 flags_ utest

.NOTPARALLEL:

check_dir:
	@if [ "$(shell pwd | sed -e 's/^.*\///')" != "out" ] ; then \
	    echo ERROR: Please call make from the top level directory. ; \
	    exit 1 ; \
	fi

$(OUT_DIR):
	mkdir $(OUT_DIR)

flags_unix:
	$(eval CFLAGS := -I. -I$(SRC_DIR) -O -Wall -W -Wno-stringop-overflow $(CFLAGS_ADDTL))
	$(eval LDFLAGS := $(LDFLAGS) --coverage $(LDFLAGS_ADDTL))
	$(eval UTEST_EXECUTABLE_NAME := unittest)
	$(eval UTEST_OBJ := $(UTEST_NORM:.c=.o))

flags_win32:
	$(eval CFLAGS := -Os -s -std=c99 -m32 -I. -I$(SRC_DIR) -Wall -W $(CFLAGS_ADDTL))
	$(eval LDFLAGS := $(LDFLAGS) -s -std=c99 -m32 $(LDFLAGS_ADDTL))
	$(eval UTEST_EXECUTABLE_NAME := unittest.exe)
	$(eval UTEST_OBJ := $(UTEST_NORM:.c=.o))

flags_:
	@echo Please call make from the top level directory.
	exit 1

utest: flags_$(BOXES_PLATFORM) | $(OUT_DIR)
	$(MAKE) -C $(OUT_DIR) -f $(UTEST_DIR)/Makefile BOXES_PLATFORM=$(BOXES_PLATFORM) UTEST_OBJ="$(UTEST_OBJ)" \
	    CFLAGS_ADDTL="$(CFLAGS_ADDTL)" flags_$(BOXES_PLATFORM) $(UTEST_EXECUTABLE_NAME)
	rm -f $(OUT_DIR)/*.gcda
	cd $(OUT_DIR) ; ./$(UTEST_EXECUTABLE_NAME)
	@OUT_DIR=$(OUT_DIR) SRC_DIR=$(SRC_DIR) ./report.sh

unittest: $(UTEST_OBJ) | check_dir
	$(CC) $(LDFLAGS) $^ $(shell cat modules.txt) -o $@ -lunistring -lpcre2-32 -lcmocka

unittest.exe: $(UTEST_OBJ) | check_dir
	$(CC) $(LDFLAGS) $^ $(shell cat modules.txt) -o $@ \
	    -lkernel32 -l:libunistring.a -l:libpcre2-32.a -l:libiconv.a -l:libcmocka.dll.a


global_mock.o:   global_mock.c global_mock.h boxes.h unicode.h tools.h config.h | check_dir
bxstring_test.o: bxstring_test.c bxstring_test.h boxes.h bxstring.h global_mock.h tools.h unicode.h utest_tools.h config.h | check_dir
cmdline_test.o:  cmdline_test.c cmdline_test.h boxes.h cmdline.h global_mock.h tools.h config.h | check_dir
logging_test.o:  logging_test.c logging_test.h boxes.h global_mock.h logging.h tools.h config.h | check_dir
tools_test.o:    tools_test.c tools_test.h tools.h unicode.h config.h | check_dir
regulex_test.o:  regulex_test.c regulex_test.h boxes.h global_mock.h regulex.h config.h | check_dir
remove_test.o:   remove_test.c remove_test.h boxes.h remove.h shape.h tools.h unicode.h global_mock.h utest_tools.h config.h | check_dir
main.o:          main.c bxstring_test.h cmdline_test.h global_mock.h tools_test.h regulex_test.h unicode_test.h config.h | check_dir
unicode_test.o:  unicode_test.c unicode_test.h boxes.h tools.h unicode.h config.h | check_dir
utest_tools.o:   utest_tools.c utest_tools.h config.h | check_dir