blob: 272df9e7bafd37bdcbbd95af4809c27aa51d1b63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#path to find lib and header files
vpath %.a ../lib
vpath %.h ../inc
CCC=g++
CC=g++
CFLAGS= -g3 -Wall -fPIC -Werror -O
CFLAGS+=$(INCLUDEPATH)
CPPFLAGS=$(CFLAGS)
#path of include files
INCLUDEPATH=-I../inc/
INCLUDEPATH+=-I/usr/include/MESA/
#parameter of lib
#LIB=-L../lib/
#LIB+=-lMESA_htable
#LIB+=-lMESA_handle_logger
#LIB+=-lMESA_prof_load
LIB+=-lMESA_field_stat2
LIB+=-lwiredcfg
#LIB_FILE=$(wildcard ../lib/*.a)
SOURCES=$(wildcard *.c)
OBJECTS=$(SOURCES:.c=.o)
DEPS=$(SOURCES:.c=.d)
#target name
TARGET=ntc_http_collect.so
.PHONY:clean all
all:$(TARGET)
$(TARGET):$(OBJECTS) $(LIB_FILE)
@awk '/_VERSION_/{print $$2}' $(SOURCES) |xargs -i echo -e "make \033[32;49;1m$@({})\033[32;49;0m \033[31;49;1m[success]\033[31;49;0m"
$(CC) -shared $(CFLAGS) $(OBJECTS) $(LIB) -o $@
#copy target to dest dir
cp -f $@ ../bin
@echo -e "copy \033[32;49;1m$@\033[32;49;0m to ../bin\033[31;49;1m[success]\033[31;49;0m"
.c.o:
%.d:%.c
$(CC) $< -MM $(INCLUDEPATH) > $@
-include $(DEPS)
clean :
rm -f $(OBJECTS) $(DEPS) $(TARGET)
|