Project

General

Profile

Bug #273 » Makefile

Modified nldev makefile for cross compiling test - Hammel, 17 Feb 2014 19:23

 
1
# nldev - NetLink Device manager 
2
# See LICENSE file for copyright and license details.
3

    
4
include config.mk
5

    
6
SRC = ${NAME}.c
7
OBJ = ${SRC:.c=.o}
8

    
9
all: options ${NAME}
10

    
11
options:
12
	@echo ${NAME} build options:
13
	@echo "CFLAGS   = ${CFLAGS}"
14
	@echo "LDFLAGS  = ${LDFLAGS}"
15
	@echo "CC       = ${CC}"
16

    
17
.c.o:
18
	@echo CC $<
19
	@${CC} -c ${CFLAGS} $<
20

    
21
${OBJ}: config.mk
22

    
23
${NAME}: ${OBJ}
24
	@echo CC -o $@
25
	@${CC} -o $@ ${OBJ} ${LDFLAGS}
26

    
27
clean:
28
	@echo cleaning
29
	@rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz
30

    
31
dist: clean
32
	@echo creating dist tarball
33
	@mkdir -p ${NAME}-${VERSION}
34
	@cp -R LICENSE Makefile README.md FIXES.md config.mk \
35
		${SRC} ${NAME}.8 *.h ${NAME}-${VERSION}
36
	@tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION}
37
	@gzip ${NAME}-${VERSION}.tar
38
	@rm -rf ${NAME}-${VERSION}
39

    
40
install: all
41
	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
42
	@mkdir -p ${DESTDIR}${PREFIX}/bin
43
	@cp -f ${NAME} ${DESTDIR}${PREFIX}/bin
44
	@cp -f run_${NAME} ${DESTDIR}${PREFIX}/bin
45
	@cp -f nltrigger ${DESTDIR}${PREFIX}/bin
46
	@chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}
47
	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man8
48
	@mkdir -p ${DESTDIR}${MANPREFIX}/man8
49
	@cp -f ${NAME}.8 ${DESTDIR}${MANPREFIX}/man8
50
	@chmod 644 ${DESTDIR}${MANPREFIX}/man8/${NAME}.8
51

    
52
uninstall:
53
	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
54
	@rm -f ${DESTDIR}${PREFIX}/bin/${NAME}
55
	@rm -f ${DESTDIR}${PREFIX}/bin/run_${NAME}
56
	@rm -f ${DESTDIR}${PREFIX}/bin/nltrigger
57
	@echo removing manual page from ${DESTDIR}${PREFIX}/man8
58
	@rm -f ${DESTDIR}${MANPREFIX}/man8/${NAME}.8
59

    
60
.PHONY: all options clean dist install uninstall
(1-1/4)