-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMakefile
76 lines (60 loc) · 1.29 KB
/
Makefile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
CFLAGS = \
-Wall \
-fPIC \
-I. \
`pkg-config --cflags libosmogsm`
LIBS = \
`pkg-config --libs libosmogsm`
OBJ = \
address.o \
assignment.o \
bit_func.o \
diag_input.o \
diag_init.o \
l3_handler.o \
output.o \
session.o
ALL_OBJS = $(OBJ) diag_import.o
TOOLS = diag_parser
all: $(TOOLS)
install: $(TOOLS)
install -d $(DESTDIR)
install $^ $(DESTDIR)
libmetagsm.a: $(OBJ)
ifeq ($(V),1)
$(AR) rcs $@ $^
else
@echo "AR $@"
@$(AR) rcs $@ $^
endif
diag_parser: diag_import.o libmetagsm.a Makefile
ifeq ($(V),1)
$(CC) -o $@ diag_import.o libmetagsm.a $(LDFLAGS) $(LIBS)
else
@echo "LINK $@"
@$(CC) -o $@ diag_import.o libmetagsm.a $(LDFLAGS) $(LIBS)
endif
clean:
@rm -f *.o libmetagsm* *.so
@rm -f $(TOOLS)
@rm -f .d/*.d
.PHONY: all clean
# dependency tracking
DEPDIR := .d
$(shell mkdir -p $(DEPDIR) >/dev/null)
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
COMPILE.c = $(CROSS_COMPILE)$(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
%.o : %.c
%.o : %.c $(DEPDIR)/%.d
ifeq ($(V),1)
$(COMPILE.c) $(OUTPUT_OPTION) $<
$(POSTCOMPILE)
else
@echo "CC $@"
@$(COMPILE.c) $(OUTPUT_OPTION) $<
@$(POSTCOMPILE)
endif
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
-include $(patsubst %,$(DEPDIR)/%.d,$(basename $(ALL_OBJS)))