File: Makefile

package info (click to toggle)
sc-im 0.8.5%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,972 kB
  • sloc: lisp: 32,533; ansic: 19,618; yacc: 1,489; xml: 518; sh: 410; makefile: 307; sed: 4
file content (128 lines) | stat: -rw-r--r-- 3,641 bytes parent folder | download | duplicates (2)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Specify the name of the resulting executable file
name = scim

# The base directory where everything should be installed.
prefix  = /usr/local

EXDIR   = $(prefix)/bin
HELPDIR = $(prefix)/share/$(name)
LIBDIR  = $(prefix)/share/doc/$(name)

# This is where the man page goes.
MANDIR  = $(prefix)/man/man1

# Change these to your liking or use `make CC=gcc` etc
#CC   = cc
#YACC = bison -y
#SED  = sed

#ifeq ($(shell uname -s),Darwin)
#  NCURSES_CFLAGS ?=
#  NCURSES_LIBS   ?= -lncursesw
#else ifeq ($(shell pkg-config --exists ncursesw || echo 'no'),no)
#  NCURSES_CFLAGS ?=
#  NCURSES_LIBS   ?= -lncursesw
#else
#  NCURSES_CFLAGS ?= $(shell pkg-config --cflags ncursesw)
#  NCURSES_LIBS   ?= $(shell pkg-config --libs ncursesw)
#endif

#LDLIBS += -lm $(NCURSES_LIBS)
LDLIBS += -lm $(shell pkg-config --libs gtk+-3.0)

CFLAGS += -Wall -g
CFLAGS += $(NCURSES_CFLAGS)
#CFLAGS += -DNCURSES
CFLAGS += -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE
CFLAGS += -DSNAME=\"$(name)\"
CFLAGS += -DHELP_PATH=\"$(HELPDIR)\"
CFLAGS += -DLIBDIR=\"$(LIBDIR)\"
CFLAGS += $(shell pkg-config --cflags gtk+-3.0)

# Sets default pager, e.g. 'less' or 'more'
CFLAGS += -DDFLT_PAGER=\"less\"
# Comment out to disable color support
CFLAGS += -DUSECOLORS
# Command history file, relative to home directory. Comment out to disable commandline history
CFLAGS += -DHISTORY_FILE=\".$(name)info\"
# Input mode history. Same as previous, but for insert mode commands
CFLAGS += -DINS_HISTORY_FILE=\".$(name)info\"
# Comment out to disable undo/redo support
CFLAGS += -DUNDO
# Maximum number of rows in spreadsheet. Up to 1048576
CFLAGS += -DMAXROWS=65536
# Used for date formatting with C-d shortcut using you local d_fmt
CFLAGS += -DUSELOCALE

# Uncomment for basic XLS import. Requires libxlsreader
#CFLAGS += -DXLS
#LDLIBS += -lxlsreader

# NOTE: libxml and libzip are required for xlsx file import support
ifneq ($(shell pkg-config --exists libzip libxml-2.0 || echo 'no'),no)
CFLAGS += -DXLSX $(shell pkg-config --cflags libxml-2.0 libzip)
LDLIBS += $(shell pkg-config --libs libxml-2.0 libzip)
endif

# NOTE: libxlsxwriter is required for xlsx file export support
ifneq (,$(wildcard /usr/include/xlsxwriter.h))
CFLAGS += -DXLSX_EXPORT
LDLIBS += -lxlsxwriter
endif

# NOTE: lua support
ifneq ($(shell pkg-config --exists lua51 || echo 'no'),no)
CFLAGS += -DXLUA $(shell pkg-config --cflags lua51)
LDLIBS += $(shell pkg-config --libs lua51) -Wl,--export-dynamic
endif
# dynamic linking
LDLIBS += -ldl


OBJS = $(patsubst %.c, %.o, $(wildcard *.c) $(wildcard utils/*.c)) gram.o

.PHONY : all clean install

all : $(name)

install :
	install -d $(DESTDIR)$(prefix)/bin
	install $(name) $(DESTDIR)$(prefix)/bin/$(name)
	install -d $(DESTDIR)$(HELPDIR)
	install doc $(DESTDIR)$(HELPDIR)/$(name)_help
	install -d $(DESTDIR)$(prefix)/share/man/man1
	install -m 644 sc-im.1 $(DESTDIR)$(prefix)/share/man/man1/$(name).1

uninstall :
	-rm $(DESTDIR)$(prefix)/bin/$(name)
	-rm $(DESTDIR)$(HELPDIR)/$(name)_help
	-rm $(DESTDIR)$(prefix)/share/man/man1/$(name).1

$(name) : $(OBJS)
	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)

$(name)qref: sc.h
	$(CC) $(CFLAGS) $(LDFLAGS) -DQREF $(QREF_FMT) -DSCNAME=\"$(name)\" -o $(name)qref help.c $(LDLIBS)

$(OBJS) : y.tab.h experres.h statres.h

y.tab.h : gram.y gram.c
	test -f y.tab.c && mv y.tab.c gram.c

gram.c : gram.y
	$(YACC) -d $<

pvmtbl.o: sc.h pvmtbl.c
	$(CC) ${CFLAGS} -c -DPSC pvmtbl.c

experres.h : gram.y
	sed -f eres.sed < gram.y > experres.h

statres.h : gram.y
	sed -f sres.sed < gram.y > statres.h

clean:
	rm -f $(OBJS)
	rm -f *res.h $(YTAB).h
	rm -f core gram.c y.output pxmalloc.c pvmtbl.c tags $(name)qref
	rm -f qhelp.c $(name)