summaryrefslogtreecommitdiffstats
path: root/lib70x/Makefile
blob: 4238546d4303cb7d2e8a230f7f14ad031bd745e9 (plain)
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
# Basic stuff
LIBMITSUD70_NAME ?= MitsuD70ImageReProcess

# Destination directories
DESTDIR ?=
LIBDIR ?= $(DESTDIR)/usr/local/lib

GP_PREFIX ?= $(shell pkg-config --variable=prefix gutenprint)

ifeq ($(GP_PREFIX),)
GP_PREFIX=/usr/local
endif
BACKEND_DATA_DIR ?= $(GP_PREFIX)/share/gutenprint/backend_data

# Tools
CC ?= $(CROSS_COMPILE)gcc
CPPCHECK ?= cppcheck
MKDIR ?= mkdir
INSTALL ?= install
RM ?= rm

# Flags
CFLAGS += -Wall -Wextra -g -Os -std=c99 -D_FORTIFY_SOURCE=2 -fPIC --no-strict-overflow # -Wconversion
#LDFLAGS +=
#CPPFLAGS +=
CFLAGS += -funit-at-a-time

ifneq (,$(findstring mingw,$(CC)))
SUFFIX=dll
else
SUFFIX=so
endif

# Build stuff
SOURCES = libMitsuD70ImageReProcess.c

# And now the rules!
.PHONY: clean all install cppcheck

all: lib$(LIBMITSUD70_NAME).$(SUFFIX)

cppcheck:
	$(CPPCHECK) -q -v --std=c99 --enable=all -I/usr/include $(CPPFLAGS) $(SOURCES)

install:
	$(MKDIR) -p $(LIBDIR)
	$(INSTALL) -o root -m 755 lib$(LIBMITSUD70_NAME).so $(LIBDIR)
	$(MKDIR) -p $(BACKEND_DATA_DIR)
	$(INSTALL) -o root -m 644 data/*raw $(BACKEND_DATA_DIR)
	$(INSTALL) -o root -m 644 data/*lut $(BACKEND_DATA_DIR)
	$(INSTALL) -o root -m 644 data/*cpc $(BACKEND_DATA_DIR)
	$(INSTALL) -o root -m 644 data/*dat $(BACKEND_DATA_DIR)
	$(INSTALL) -o root -m 644 data/*csv $(BACKEND_DATA_DIR)

clean:
	$(RM) -f lib$(LIBMITSUD70_NAME).$(SUFFIX) *.o

lib$(LIBMITSUD70_NAME).$(SUFFIX):  $(SOURCES:.c=.o)
	$(CC) $(LDFLAGS) -g -shared -o $@ $^

%.o: %.c
	$(CC) -c $(CFLAGS) -o $@ $<