make: Add pgo-build target
This commit is contained in:
parent
08352deca9
commit
2b3ea4bb0c
1 changed files with 25 additions and 9 deletions
34
Makefile
34
Makefile
|
@ -5,10 +5,11 @@ VERSION = 1.5
|
|||
PREFIX ?= /usr/local
|
||||
MANPREFIX ?= ${PREFIX}/share/man
|
||||
CFLAGS += -DVERSION=\"${VERSION}\"
|
||||
PGO_GEN = ${CFLAGS} -fprofile-generate
|
||||
PGO_USE = ${CFLAGS} -fprofile-use -fprofile-correction
|
||||
LDFLAGS ?=
|
||||
CC ?= cc
|
||||
SRC = smu.c
|
||||
OBJ = smu.o
|
||||
|
||||
all: smu
|
||||
|
||||
|
@ -18,15 +19,30 @@ options:
|
|||
@echo "LDFLAGS = ${LDFLAGS}"
|
||||
@echo "CC = ${CC}"
|
||||
|
||||
.c.o:
|
||||
@echo CC $<
|
||||
@${CC} -c ${CFLAGS} $<
|
||||
smu: ${SRC}
|
||||
@echo CC $@
|
||||
@${CC} -o $@ ${SRC} ${CFLAGS} ${LDFLAGS}
|
||||
|
||||
${OBJ}: ${SRC}
|
||||
pgo-build: ${SRC}
|
||||
@echo CC smu
|
||||
@${CC} -o smu ${SRC} ${PGO_GEN} ${LDFLAGS}
|
||||
@echo Generating pgo data
|
||||
@printf .
|
||||
@./smu testdoc > /dev/null
|
||||
@printf .
|
||||
@cat testdoc | ./smu > /dev/null
|
||||
@printf .
|
||||
@./smu -n testdoc > /dev/null
|
||||
@printf .
|
||||
@cat testdoc | ./smu -n > /dev/null
|
||||
@printf .
|
||||
@rm smu
|
||||
@printf '\n'
|
||||
@echo Recompiling with pgo data
|
||||
@echo CC smu
|
||||
@${CC} -o smu ${SRC} ${PGO_USE} ${LDFLAGS}
|
||||
@rm smu.gcda
|
||||
|
||||
smu: ${OBJ}
|
||||
@echo LD $@
|
||||
@${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f smu ${OBJ} ${LIBOBJ} smu-${VERSION}.tar.gz
|
||||
|
@ -50,4 +66,4 @@ uninstall:
|
|||
rm -f ${DESTDIR}${PREFIX}/bin/smu
|
||||
rm -f ${DESTDIR}${MANPREFIX}/man1/smu.1
|
||||
|
||||
.PHONY: all options clean dist install uninstall
|
||||
.PHONY: all options clean dist install uninstall pgo-build
|
||||
|
|
Loading…
Add table
Reference in a new issue