1 | # $URL: http://subversion:8080/svn/gsc/trunk/drivers/LINUX/18AI32SSC1M/savedata/makefile $ |
---|
2 | # $Rev: 27428 $ |
---|
3 | # $Date: 2014-06-26 13:17:48 -0500 (Thu, 26 Jun 2014) $ |
---|
4 | |
---|
5 | DEVICE = 18ai32ssc1m |
---|
6 | default: all |
---|
7 | |
---|
8 | CC = gcc |
---|
9 | CC_FLAGS = -c -Wall |
---|
10 | CC_FLAGS += -I. |
---|
11 | CC_FLAGS += -I../driver |
---|
12 | CC_FLAGS += -I../docsrc |
---|
13 | CC_FLAGS += -I../utils |
---|
14 | DEP_FILE = makefile.dep |
---|
15 | LIB_FILES = ../utils/${DEVICE}_utils.a |
---|
16 | LIB_FILES += ../docsrc/${DEVICE}_dsl.a |
---|
17 | LIB_FILES += ../utils/gsc_utils.a |
---|
18 | TARGET = savedata |
---|
19 | VPATH = |
---|
20 | |
---|
21 | ECHO := ${shell ls /bin/echo 2>/dev/null | wc -l} |
---|
22 | ifeq ("${ECHO}","1") |
---|
23 | ECHO := /bin/echo |
---|
24 | else |
---|
25 | ECHO := echo |
---|
26 | endif |
---|
27 | |
---|
28 | OBJ_FILES = \ |
---|
29 | main.o \ |
---|
30 | savedata.o |
---|
31 | |
---|
32 | .c.o: |
---|
33 | @echo == Compiling: $< |
---|
34 | @-chmod +rw ${DEP_FILE} |
---|
35 | @# Get the dependency list for this module. |
---|
36 | @-${CC} -MM ${CC_FLAGS} $< > .tmp1 |
---|
37 | @# Remove the trailing white space and backslash. |
---|
38 | @-sed -e "s/[ ]*[\\\\]//g" < .tmp1 > .tmp2 |
---|
39 | @# Put everything on seperate lines. |
---|
40 | @-tr [:space:] \\n < .tmp2 > .tmp3 |
---|
41 | @# Remove all of the system include files. |
---|
42 | @-grep -v "^[ ]*/" < .tmp3 > .tmp4 |
---|
43 | @# Remove all empty lines. |
---|
44 | @-grep [[:alnum:]] < .tmp4 > .tmp5 |
---|
45 | @# Put everything on the same line. |
---|
46 | @-tr '\n' '\040' < .tmp5 > .tmp6 |
---|
47 | @-${ECHO} -e '\012' >> .tmp6 |
---|
48 | @# Add all of the other dependencies to the end of this file. |
---|
49 | @-echo >> ${DEP_FILE} |
---|
50 | @-grep -v "^[ ]*$@" < ${DEP_FILE} >> .tmp6 |
---|
51 | @# Remove blank lines from the list. |
---|
52 | @-grep "[[:alnum:]]" < .tmp6 > .tmp7 |
---|
53 | @# Sort the list and put it in the dependency file. |
---|
54 | @-sort < .tmp7 > ${DEP_FILE} |
---|
55 | @# Cleanup. |
---|
56 | @rm -f ${DEP_FILE}.tmp* .tmp* |
---|
57 | @# Compile the module. |
---|
58 | @${CC} ${CC_FLAGS} $< -o $@ |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | all: ${TARGET} |
---|
63 | @echo ==== All Done |
---|
64 | |
---|
65 | release: ${TARGET} |
---|
66 | @rm -f *.a *.o ${OBJ_FILES} |
---|
67 | @echo ==== Release Done |
---|
68 | |
---|
69 | clean: |
---|
70 | @echo ==== Cleaning ${TARGET} ... |
---|
71 | @rm -f *.a *.o *.scc ${TARGET} |
---|
72 | @-chmod +rw ${DEP_FILE} |
---|
73 | @echo > ${DEP_FILE} |
---|
74 | |
---|
75 | ${TARGET}: ${OBJ_FILES} ${LIB_FILES} |
---|
76 | @echo ==== Linking: $@ |
---|
77 | @${CC} ${OBJ_FILES} ${LIB_FILES} -lm -lpthread -lrt -o $@ |
---|
78 | |
---|
79 | ${DEP_FILE}: |
---|
80 | @echo ==== Creating: $@ |
---|
81 | @echo > ${DEP_FILE} |
---|
82 | |
---|
83 | include ${DEP_FILE} |
---|