82 lines
1.8 KiB
Makefile
82 lines
1.8 KiB
Makefile
#
|
|
# Makefile for usqlite
|
|
#
|
|
#
|
|
# 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/>.
|
|
|
|
.PHONY: all clean opkg release
|
|
|
|
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}
|
|
|
|
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}"
|
|
|