💾 Archived View for gemini.conman.org › extensions › Makefile captured on 2020-11-07 at 00:45:37.

View Raw

More Information

⬅️ Previous capture (2020-10-31)

➡️ Next capture (2021-12-03)

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

#########################################################################
#
# Copyright 2019 by Sean Conner.  All Rights Reserved.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This library 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 Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, see <http://www.gnu.org/licenses/>.
#
# Comments, questions and criticisms can be sent to: sean@conman.org
#
########################################################################

CC      = c99
CFLAGS  = -g -fPIC -Os
LDFLAGS = -g -shared

INSTALL         = /usr/bin/install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA    = $(INSTALL) -m 644

prefix          = /usr/local
libdir		= $(prefix)/lib
datarootdir     = $(prefix)/share
dataroot	= $(datarootdir)

LUA             ?= lua
LUA_VERSION     := $(shell $(LUA) -e "print(_VERSION:match '^Lua (.*)')")
LUADIR          ?= $(dataroot)/lua/$(LUA_VERSION)
LIBDIR          ?= $(libdir)/lua/$(LUA_VERSION)

ifneq ($(LUA_INCDIR),)
  override CFLAGS += -I$(LUA_INCDIR)
endif

PEG		= peg

# ===================================================

.PHONY: install uninstall clean luacheck

%.so : %.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ {body}lt; $(LDLIBS)

%.i : %.peg
	$(PEG) -o $@ {body}lt;

install: port70/handlers/blog/html.so
	$(INSTALL) -d $(DESTDIR)$(LUADIR)/org/conman/app/GLV-1/handlers/blog
	$(INSTALL) -d $(DESTDIR)$(LUADIR)/org/conman/app/port70/handlers/blog
	$(INSTALL) -d $(DESTDIR)$(LIBDIR)/org/conman/app/port70/handlers/blog
	
	$(INSTALL_DATA)    GLV-1/handlers/*.lua       $(DESTDIR)$(LUADIR)/org/conman/app/GLV-1/handlers/
	$(INSTALL_DATA)    GLV-1/handlers/blog/*.lua  $(DESTDIR)$(LUADIR)/org/conman/app/GLV-1/handlers/blog/
	$(INSTALL_DATA)    port70/handlers/*.lua      $(DESTDIR)$(LUADIR)/org/conman/app/port70/handlers/
	$(INSTALL_DATA)    port70/handlers/blog/*.lua $(DESTDIR)$(LUADIR)/org/conman/app/port70/handlers/blog/
	$(INSTALL_PROGRAM) port70/handlers/blog/*.so  $(DESTDIR)$(LIBDIR)/org/conman/app/port70/handlers/blog/

uninstall:
	$(RM) -r $(DESTDIR)$(LUADIR)/org/conman/app/GLV-1
	$(RM) -r $(DESTDIR)$(LUADIR)/org/conman/app/port70
	$(RM) -r $(DESTDIR)$(LIBDIR)/org/conman/app/port70

clean:
	$(RM) -r $(shell find . -name '*~')
	$(RM) -r $(shell find . -name '*.i')
	$(RM) -r $(shell find . -name '*.so')

luacheck:
	luacheck $(shell find . -name '*.lua')

port70/handlers/blog/html.so : port70/handlers/blog/html.c port70/handlers/blog/html.i