usqlite/Makefile

82 lines
1.8 KiB
Makefile
Raw Permalink Normal View History

2020-08-15 12:02:47 +00:00
#
# Makefile for usqlite
#
2020-08-17 01:32:40 +00:00
#
# Copyright (C) 2020 /df <https://git.hpkg.tv/df/usqlite/>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.
2020-08-15 12:02:47 +00:00
.PHONY: all clean opkg release
2020-08-14 23:10:03 +00:00
MAKE=gmake
DEFS=
SRCS= usqlite.c
HDRS=
OBJS= $(SRCS:.c=.o)
CC=gcc
#CC=mipsel-linux-gcc
DEFS=-D_XOPEN_SOURCE=500 -DTGT_SQLITE_VERSION_NUMBER=3007002
CFLAGS=-g -std=c99
INCS=
LIBS=
#CFLAGS=-g -O3 -fno-strict-aliasing
WARN=-pedantic -Wall -W -Wnested-externs -Wpointer-arith -Wno-long-long
PLATFORM=$(shell uname -s | cut -d- -f1)
ifeq ($(PLATFORM),Linux)
LIBS=-lsqlite3
endif
all: usqlite
usqlite: ${OBJS}
@echo "Linking..."
@-[ -f $@ ] && mv $@ $@~ || exit 0
${CC} -static-libgcc \
${WARN} \
${DEFS} \
${CFLAGS} -o $@ \
${OBJS} \
${LIBS}
@echo "Done..."
clean:
rm -f usqlite usqlite~ core ${OBJS}
.c.o:
@echo " $<"
@$(CC) $(CFLAGS) ${WARN} ${DEFS} ${INCS} -c $< -o $@
${OBJS}: ${HDRS}
2020-08-15 12:02:47 +00:00
usqlite.stripped: usqlite
strip -o $@ $<
install: usqlite.stripped
install $< /mod/bin/$(basename $(notdir $<))
opkg: usqlite.stripped $(wildcard opkg/CONTROL/*)
install -D -p usqlite opkg/boot/$(basename $(notdir $<))
opkg-pack opkg
release: opkg
tagname=$$(echo usqlite*.opk | sed -n 'p;q') && \
tagname="$${tagname%_*.*}" && \
test -n "$${tagname}" && \
git tag -f -a -m "Release $${tagname}" "$${tagname}"
2020-08-14 23:10:03 +00:00