Skip to content

Commit

Permalink
Makefile improved
Browse files Browse the repository at this point in the history
Add "install" target and other enhancements needed for RPM builds
  • Loading branch information
JiriHorky authored and root committed Oct 10, 2013
1 parent 4150532 commit f440473
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Makefile
Expand Up @@ -2,20 +2,30 @@

CFLAGS := -std=c99 -Wall -pedantic -Wextra -Werror ${CFLAGS}
LDLIBS = -ljansson
INSTALL=install
DESTDIR?=/
MANDIR=$(DESTDIR)/usr/share/man/man1/
TARGET_PATH=$(DESTDIR)/usr/bin
DISTFILES=jshon
MANFILE=jshon.1

#VERSION=$(shell date +%Y%m%d)
VERSION=$(shell git show -s --format="%ci" HEAD | cut -d ' ' -f 1 | tr -d '-')
#VERSION=$(grep "^#define JSHONVER" | cut -d ' ' -f 3)

all: jshon
all: $(DISTFILES)

jshon: jshon.o
$(DISTFILES): jshon.o

strip: jshon
strip --strip-all jshon
strip: $(DISFILES)
strip --strip-all $(DISTFILES)

clean:
rm -f *.o jshon
rm -f *.o $(DISTFILES)

install:
$(INSTALL) -D $(DISTFILES) $(TARGET_PATH)/$(DISTFILES)
$(INSTALL) -D $(MANFILE) $(MANDIR)/$(MANFILE)

dist: clean
sed -i "s/#define JSHONVER .*/#define JSHONVER ${VERSION}/" jshon.c
Expand Down

0 comments on commit f440473

Please sign in to comment.