Skip to content

Commit

Permalink
Merge branch 'make-release'
Browse files Browse the repository at this point in the history
* make-release:
  Makefile: add release rule
  Makefile: avoid full rebuilds when the Makefile changes
  Makefile: build appimage-runtime and appimage-runtime-zstd
  Makefile: use bash as SHELL

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Jun 6, 2021
2 parents dcfedaf + dba5aa7 commit 2d7df59
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SHELL ::= /bin/bash -o pipefail

all: # default target

CC ?= clang
Expand All @@ -10,28 +12,43 @@ LDFLAGS ::= -pthread
SQUASHLIBS ::= squashfs squashfuse squashfuse_ll fuse fuseprivate
UNZLIBS ::= zstd lz4 z lzo2 lzma
LIBS ::= -ldl $(SQUASHLIBS:%=-l:lib%.a)
TARGETS ::=

# == runtime.c ==
runtime.o: src/runtime.c $(wildcard src/*.c src/*.h) Makefile
runtime.o: src/runtime.c $(wildcard src/*.c src/*.h)
$(CC) $(INCLUDES) $(DEFS) $(OPTIMIZE) $(PKG_CFLAGS) $(CFLAGS) -c $< -o $@

# == runtime ==
runtime: runtime.o
# == appimage-runtime ==
appimage-runtime: runtime.o
$(CC) $(OPTIMIZE) $(PKG_CFLAGS) $(CFLAGS) $(LDFLAGS) \
$< -o $@ $(LIBS) $(UNZLIBS:%=-l:lib%.a)
strip $@
all: runtime
TARGETS += appimage-runtime

# == runtime-zstd ==
runtime-zstd: runtime.o src/mocklibs.c
# == appimage-runtime-zstd ==
appimage-runtime-zstd: runtime.o src/mocklibs.c
$(CC) $(OPTIMIZE) $(PKG_CFLAGS) $(CFLAGS) $(LDFLAGS) \
src/mocklibs.c -DWITH_ZSTD \
$< -o $@ $(LIBS) $(UNZLIBS:%=-l:lib%.a) \
$(LIBS) -l:libzstd.a
strip $@
all: runtime-zstd
TARGETS += appimage-runtime-zstd

# == clean ==
clean:
rm -f *.o runtime runtime-zstd
rm -f *.o appimage-runtime appimage-runtime-zstd

# == all ==
all: $(TARGETS)

# == release ==
release: all
@ git merge-base --is-ancestor HEAD origin/trunk || { echo "ERROR: HEAD not published in origin/trunk" ; false ; }
@ rm -f .release && D=`date +%y.%m | sed 's/\.0/./g'` && \
for n in `seq 0 99` ; do git rev-parse $$D.$$n >/dev/null 2>&1 || { echo $$D.$$n >.release; break ; } ; done
@ R=`cat .release` && rm -f .release && echo -e "\n# RELEASE: appimage-runtime v$$R:" && \
echo "hub release create -dpo -m 'appimage-runtime v$$R' $$R $(TARGETS:%=-a %)" && \
echo '^^^^^^^^^^^^^^^^^^ Enter to execute... ' && \
read && \
hub release create -dpo -m "appimage-runtime v$$R" $$R $(TARGETS:%=-a %)

0 comments on commit 2d7df59

Please sign in to comment.