usqlite/Makefile
2020-08-15 13:02:47 +01:00

68 lines
1.2 KiB
Makefile

#
# Makefile for usqlite
#
.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}"