File: Makefile

package info (click to toggle)
ccextractor 0.87+ds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 10,064 kB
  • sloc: ansic: 172,772; makefile: 777; sh: 622; python: 319
file content (58 lines) | stat: -rw-r--r-- 1,415 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
SHELL = /bin/sh

CC=gcc
# SYS := $(shell gcc -dumpmachine)
CFLAGS=-O0 -std=gnu99 -D ENABLE_OCR -g -ggdb -rdynamic
#-Q -da -v

# enable COVERAGE
# CFLAGS+=-fprofile-arcs -ftest-coverage

# add debug flag
ifdef DEBUG
CFLAGS+=-DDEBUG
endif

#ALL_FLAGS = -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DVERSION_FILE_PRESENT
LDFLAGS=-lm -g

CFLAGS+=$(shell pkg-config --cflags check)
LDFLAGS+=$(shell pkg-config --libs check)

# TODO: need to rewrite this. Need new way to load sources for testing
OBJS=$(filter-out ../linux/objs/ccextractor.o, $(wildcard ../linux/objs/*.o))

SRC_SUITE=$(wildcard *_suite.c)
OBJ_SUITE=$(patsubst %_suite.c, %_suite.o, $(SRC_SUITE))

OBJS+=$(OBJ_SUITE)

all: clean test

%.o: %.c
	# explicit output name :  -o $@
	$(CC) -c $(ALL_FLAGS) $(CFLAGS) $<

runtest: $(OBJS)
	@echo "+----------------------------------------------+"
	@echo "|                 BUILD TESTS                  |"
	@echo "+----------------------------------------------+"
	$(CC) -c $(ALL_FLAGS) $(CFLAGS) $@.c
	$(CC) $@.o $^ $(ALL_FLAGS) $(CFLAGS) $(LDFLAGS) -o $@

.PHONY: test
test: runtest
	@echo "+----------------------------------------------+"
	@echo "|                 START TESTS                  |"
	@echo "+----------------------------------------------+"
	./runtest

.PHONY: clean
clean:
	rm runtest || true
	rm *.o || true
	# coverage info
	rm *.gcda || true
	rm *.gcno || true
	# debug info
	rm *.c.* || true