TR181-XPON  1.4.0
TR-181 PON manager.
makefile
Go to the documentation of this file.
1 include ../makefile.inc
2 
3 # build destination directories
4 OUTPUTDIR = ../output/$(MACHINE)
5 OBJDIR = $(OUTPUTDIR)
6 
7 # TARGETS
8 TARGET_SO = $(OBJDIR)/$(COMPONENT).so
9 
10 # directories
11 # source directories
12 SRCDIR = .
13 INCDIR_PRIV = ../include_priv
14 INCDIRS = $(INCDIR_PRIV) $(if $(STAGINGDIR), $(STAGINGDIR)/include) $(if $(STAGINGDIR), $(STAGINGDIR)/usr/include)
15 STAGING_LIBDIR = $(if $(STAGINGDIR), -L$(STAGINGDIR)/lib) $(if $(STAGINGDIR), -L$(STAGINGDIR)/usr/lib)
16 
17 SOURCES := $(wildcard $(SRCDIR)/*.c)
18 OBJECTS := $(addprefix $(OBJDIR)/,$(notdir $(SOURCES:.c=.o)))
19 
20 # compilation and linking flags
21 CFLAGS += -Werror -Wall -Wextra \
22  -Wformat=2 -Wshadow \
23  -Wwrite-strings -Wredundant-decls \
24  -Wno-attributes \
25  -Wno-format-nonliteral \
26  -fPIC -g3 $(addprefix -I ,$(INCDIRS)) \
27  -DSAHTRACES_ENABLED -DSAHTRACES_LEVEL=500
28 
29 # Many plugins use following flag. I put it in comment because I do not always
30 # provide a declaration. E.g. there's no declaration for _onu_enable_changed().
31 # IMO that's not a problem as it's not needed.
32 #CFLAGS += -Wmissing-declarations
33 
34 ifeq ($(CC_NAME),g++)
35 CFLAGS += -std=c++2a
36 else
37 CFLAGS += -Wstrict-prototypes -Wold-style-definition -Wnested-externs -std=c11
38 endif
39 
40 ifneq ($(CONFIG_SAH_AMX_TR181_XPON_MAX_ONUS),)
41 CFLAGS += -DMAX_NR_OF_ONUS=$(CONFIG_SAH_AMX_TR181_XPON_MAX_ONUS)
42 else
43 $(error CONFIG_SAH_AMX_TR181_XPON_MAX_ONUS is not defined)
44 endif
45 
46 # Uncomment next CFLAGS line to have extra logging to stdout
47 #CFLAGS += -D_DEBUG_
48 
49 LDFLAGS += -shared -fPIC $(STAGING_LIBDIR) \
50  -lamxb -lamxc -lamxp -lamxd -lamxo -lamxm -lsahtrace
51 
52 # Link to dl because of dlerror() call
53 LDFLAGS += -ldl
54 
55 # targets
56 all: $(TARGET_SO)
57 
58 $(TARGET_SO): $(OBJECTS)
59  $(CC) -Wl,-soname,$(COMPONENT).so -o $@ $(OBJECTS) $(LDFLAGS)
60 
61 -include $(OBJECTS:.o=.d)
62 
63 $(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)/
64  $(CC) $(CFLAGS) -c -o $@ $<
65  @$(CC) $(CFLAGS) -MM -MP -MT '$(@) $(@:.o=.d)' -MF $(@:.o=.d) $(<)
66 
67 $(OBJDIR)/:
68  $(MKDIR) -p $@
69 
70 clean:
71  rm -rf ../output/ ../$(COMPONENT)-*.* ../$(COMPONENT)_*.*
72 
73 .PHONY: all clean