💾 Archived View for gmi.noulin.net › gitRepositories › systemSetup › file › termux › Makefile.gmi captured on 2024-07-09 at 03:00:55. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

systemSetup

Log

Files

Refs

README

LICENSE

Makefile (6394B)

     1 # Specify the name of the resulting executable file
     2 name = sc-im
     3 
     4 # The base directory where everything should be installed.
     5 prefix  = /data/data/com.termux/files/usr/
     6 
     7 EXDIR   = $(prefix)/bin
     8 HELPDIR = $(prefix)/share/$(name)
     9 LIBDIR  = $(prefix)/share/doc/$(name)
    10 
    11 # This is where the man page goes.
    12 MANDIR  = $(prefix)/share/man/man1
    13 
    14 # Change these to your liking or use `make CC=gcc` etc
    15 #CC   = cc
    16 #YACC = bison -y
    17 #SED  = sed
    18 
    19 LDLIBS += -lm -landroid-support -lncurses
    20 
    21 CFLAGS += -Wall -g -I/data/data/com.termux/files/usr/include/libandroid-support/
    22 CFLAGS += -DNCURSES
    23 CFLAGS += -D_XOPEN_SOURCE_EXTENDED -D_GNU_SOURCE
    24 CFLAGS += -DSNAME=\"$(name)\"
    25 CFLAGS += -DHELP_PATH=\"$(HELPDIR)\"
    26 CFLAGS += -DLIBDIR=\"$(LIBDIR)\"
    27 
    28 # Sets default pager, e.g. 'less' or 'more'
    29 CFLAGS += -DDFLT_PAGER=\"less\"
    30 # Sets default editor. Its use in case EDITOR env variable is not set
    31 CFLAGS += -DDFLT_EDITOR=\"vim\"
    32 # Comment out to disable color support
    33 CFLAGS += -DUSECOLORS
    34 # Command history file, relative to home directory. Comment out to disable commandline history
    35 CFLAGS += -DHISTORY_FILE=\".$(name)info\"
    36 # Input mode history. Same as previous, but for insert mode commands
    37 CFLAGS += -DINS_HISTORY_FILE=\".$(name)info\"
    38 # Comment out to disable undo/redo support
    39 CFLAGS += -DUNDO
    40 # Maximum number of rows in spreadsheet. Up to 1048576
    41 CFLAGS += -DMAXROWS=65536
    42 # Used for date formatting with C-d shortcut using you local d_fmt
    43 CFLAGS += -DUSELOCALE
    44 
    45 # Clipboard support is OS dependent.
    46 #
    47 # Choose one of the following commands for copying to different clipboards:
    48 # You can later change it at runtime.
    49 #to copy to tmux clipboard:
    50 CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""tmux load-buffer"\"
    51 #to copy to X clipboard:
    52 #CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""xclip -i -selection clipboard <"\"
    53 #to copy to OSX clipboard:
    54 #CFLAGS += -DDEFAULT_COPY_TO_CLIPBOARD_CMD=\""pbcopy <"\"
    55 #
    56 # Choose one of the proposed commands for pasting from different clipboards:
    57 # You can later change it at runtime.
    58 CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""tmux show-buffer"\"
    59 #CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""xclip -o -selection clipboard"\"
    60 #CFLAGS += -DDEFAULT_PASTE_FROM_CLIPBOARD_CMD=\""pbpaste"\"
    61 
    62 # Uncomment for basic XLS import. Requires libxlsreader
    63 #CFLAGS += -DXLS
    64 #LDLIBS += -lxlsreader
    65 
    66 # Autobackup. If you unset this, no backup check nor autobackup feature will be available.
    67 CFLAGS += -DAUTOBACKUP
    68 # Have threads? Set these two, if you want the autobackup feature to work with threads.
    69 CFLAGS += -DHAVE_PTHREAD
    70 
    71 ifneq ($(shell uname -s),Darwin)
    72   LDLIBS += -pthread
    73 endif
    74 
    75 # NOTE: libxlsxwriter is required for xlsx file export support
    76 ifneq (,$(wildcard /usr/include/xlsxwriter.h))
    77   CFLAGS += -DXLSX_EXPORT
    78   LDLIBS += -lxlsxwriter
    79 endif
    80 ifneq (,$(wildcard /usr/local/include/xlsxwriter.h))
    81   CFLAGS += -DXLSX_EXPORT
    82   LDLIBS += -lxlsxwriter
    83 endif
    84 
    85 # Check for gnuplot existance
    86 ifneq (, $(shell which gnuplot))
    87   CFLAGS += -DGNUPLOT
    88 endif
    89 
    90 # dynamic linking (not available in BSD)
    91 ifneq ($(shell uname -s | grep -o BSD),BSD)
    92   LDLIBS += -ldl
    93 endif
    94 
    95 ifneq (, $(shell which pkg-config))
    96   # Any system with pkg-config
    97 
    98   # NOTE: ncursesw (required)
    99   ifeq ($(shell uname -s),Darwin)
   100     # macOS' ncurses is built with wide-char support
   101     LDFLAGS += -lncurses
   102   else ifneq ($(shell pkg-config --exists ncursesw || echo 'no'),no)
   103     CFLAGS += $(shell pkg-config --cflags ncursesw)
   104     LDLIBS += $(shell pkg-config --libs ncursesw)
   105   else ifneq ($(shell pkg-config --exists ncurses || echo 'no'),no)
   106     # hopefully this includes wide character support then
   107     CFLAGS += $(shell pkg-config --cflags ncurses)
   108     LDLIBS += $(shell pkg-config --libs ncurses)
   109   else
   110     LDLIBS += -lncursesw
   111   endif
   112 
   113   # NOTE: libxml and libzip are required for xlsx file import support
   114   ifneq ($(shell pkg-config --exists libzip libxml-2.0 || echo 'no'),no)
   115     CFLAGS += -DXLSX $(shell pkg-config --cflags libxml-2.0 libzip)
   116     LDLIBS += $(shell pkg-config --libs libxml-2.0 libzip)
   117   endif
   118 
   119   # NOTE: lua support
   120   ifneq ($(shell pkg-config --exists lua51 || echo 'no'),no)
   121     CFLAGS += -DXLUA $(shell pkg-config --cflags lua51)
   122     LDLIBS += $(shell pkg-config --libs lua51) -Wl,--export-dynamic
   123   else ifneq ($(shell pkg-config --exists lua-5.1 || echo 'no'),no) # FreeBSD
   124     CFLAGS += -DXLUA $(shell pkg-config --cflags lua-5.1)
   125     ifneq ($(shell uname -s),Darwin)
   126       LDLIBS += $(shell pkg-config --libs lua-5.1) -Wl,--export-dynamic
   127     else
   128       LDLIBS += $(shell pkg-config --libs lua-5.1) -rdynamic
   129     endif
   130   endif
   131 else ifeq ($(shell uname -s),Darwin)
   132   # macOS without pkg-config
   133 
   134   # macOS' ncurses is built with wide-char support
   135   LDFLAGS += -lncurses
   136 else ifeq ($(shell uname -s),NetBSD)
   137   # NetBSD without pkg-config
   138 
   139   CFLAGS  += -I/usr/pkg/include
   140   CFLAGS  += -I/usr/pkg/include/ncursesw
   141 
   142   LDFLAGS += -L/usr/pkg/lib
   143   LDFLAGS += -Wl,-R/usr/pkg/lib
   144 
   145   LDLIBS += -lncursesw
   146 endif
   147 
   148 OBJS = $(patsubst %.c, %.o, $(wildcard *.c) $(wildcard utils/*.c)) gram.o
   149 
   150 .PHONY : all clean install docs man_install man_uninstall
   151 
   152 all : $(name)
   153 
   154 install :
   155         install -d $(DESTDIR)$(prefix)/bin
   156         install $(name) $(DESTDIR)$(prefix)/bin/$(name)
   157         install -d $(DESTDIR)$(HELPDIR)
   158         install doc $(DESTDIR)$(HELPDIR)/$(name)_help
   159         install plot_* $(DESTDIR)$(HELPDIR)/
   160         install -d $(DESTDIR)$(MANDIR)/
   161         install -m 644 sc-im.1 $(DESTDIR)$(MANDIR)/$(name).1
   162 
   163 uninstall :
   164         -rm $(DESTDIR)$(prefix)/bin/$(name)
   165         -rm $(DESTDIR)$(HELPDIR)/$(name)_help
   166         -rm $(DESTDIR)$(HELPDIR)/plot*
   167         -rm $(DESTDIR)$(MANDIR)/$(name).1
   168 
   169 $(name) : $(OBJS)
   170         $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
   171 
   172 $(name)qref: sc.h
   173         $(CC) $(CFLAGS) $(LDFLAGS) -DQREF $(QREF_FMT) -DSCNAME=\"$(name)\" -o $(name)qref help.c $(LDLIBS)
   174 
   175 $(OBJS) : y.tab.h experres.h statres.h
   176 
   177 y.tab.h : gram.y gram.c
   178         test -f y.tab.c && mv y.tab.c gram.c
   179 
   180 gram.c : gram.y
   181         $(YACC) -d {body}lt;
   182 
   183 pvmtbl.o: sc.h pvmtbl.c
   184         $(CC) ${CFLAGS} -c -DPSC pvmtbl.c
   185 
   186 experres.h : gram.y
   187         sed -f eres.sed < gram.y > experres.h
   188 
   189 statres.h : gram.y
   190         sed -f sres.sed < gram.y > statres.h
   191 
   192 docs:
   193         doxygen Doxyfile
   194 
   195 man_install:
   196         @cp -r ../docs/man/man3/ /usr/local/share/man/
   197         mandb
   198 
   199 # "sc-im" MUST match what is in Doxyfile `MAN_EXTENSION = .sc-im.3`
   200 man_uninstall:
   201         @rm -rf /usr/local/share/man/man3/*sc-im.3
   202         @mandb
   203 
   204 clean:
   205         rm -f $(OBJS)
   206         rm -f *res.h y.tab.h
   207         rm -f core gram.c y.output pxmalloc.c pvmtbl.c tags $(name)qref
   208         rm -f qhelp.c $(name)
   209         rm -rf ../docs/