139 lines
4.0 KiB
Makefile
139 lines
4.0 KiB
Makefile
####################################################### -*- Makefile -*-
|
|
##
|
|
########################################################################
|
|
##
|
|
@strict token off@
|
|
@ifconf ${name}_Makefile@
|
|
@ print ${name}_Makefile exists, skipping@
|
|
@else@
|
|
@ if "x$m2c_create_fewer_files" eq "x"@
|
|
@ eval $m2c_create_fewer_files = 0@
|
|
@ end@
|
|
@ open ${name}_Makefile@
|
|
@ ifconf ${name}_Makefile.m2m@
|
|
@ include ${name}_Makefile.m2m@
|
|
@ else@
|
|
########################################################################
|
|
@ if $m2c_mark_boundary == 1@
|
|
# START code generated by mfd-makefile.m2m
|
|
@ end@
|
|
########################################################################
|
|
|
|
CC=gcc
|
|
TABLE_PREFIX=${name}
|
|
|
|
@ if "$mfd_netsnmp_dir" ne ""@
|
|
NETSNMPDIR=$mfd_netsnmp_dir
|
|
NETSNMPCONFIG=$(NETSNMPDIR)/net-snmp-config
|
|
@ else@
|
|
NETSNMPCONFIG=net-snmp-config
|
|
@ end@
|
|
|
|
@ if "$mfd_netsnmp_dir" ne ""@
|
|
|
|
# Assuming we're linking against a Net-SNMP build tree (which may or
|
|
# may not be the same as the source tree) and not an installed package.
|
|
|
|
# Note: to do this we REQUIRE gnu-make.
|
|
|
|
NETSNMPBASECFLAGS := $(shell $(NETSNMPCONFIG) --base-cflags)
|
|
NETSNMPINCLUDES := $(shell $(NETSNMPCONFIG) --build-includes $(NETSNMPDIR))
|
|
# base flags after build/src include, in case it has /usr/local/include
|
|
NETSNMPCFLAGS=$(NETSNMPINCLUDES) $(NETSNMPBASECFLAGS)
|
|
|
|
NETSNMPBASELIBS := $(shell $(NETSNMPCONFIG) --base-agent-libs)
|
|
NETSNMPEXTLIBS := $(shell $(NETSNMPCONFIG) --external-agent-libs)
|
|
NETSNMPLIBDIRS := $(shell $(NETSNMPCONFIG) --build-lib-dirs $(NETSNMPDIR))
|
|
NETSNMPLIBDEPS := $(shell $(NETSNMPCONFIG) --build-lib-deps $(NETSNMPDIR))
|
|
LIB_DEPS=$(NETSNMPLIBDEPS)
|
|
LIBS=$(NETSNMPLIBDIRS) -Wl,-Bstatic $(NETSNMPBASELIBS) -Wl,-Bdynamic $(NETSNMPEXTLIBS)
|
|
|
|
@ else@
|
|
|
|
# uncomment this if you have GNU make
|
|
#NETSNMPCFLAGS := $(shell $(NETSNMPCONFIG) --base-cflags)
|
|
#NETSNMPLIBS := $(shell $(NETSNMPCONFIG) --agent-libs)
|
|
NETSNMPCFLAGS=`$(NETSNMPCONFIG) --base-cflags`
|
|
NETSNMPLIBS=`$(NETSNMPCONFIG) --agent-libs`
|
|
|
|
LIBS=$(NETSNMPLIBS)
|
|
|
|
@ end@
|
|
|
|
STRICT_FLAGS = -Wall -Wstrict-prototypes
|
|
CFLAGS=-I. $(NETSNMPCFLAGS) $(STRICT_FLAGS)
|
|
|
|
USER_SRCS = \
|
|
@ if $m2c_create_fewer_files != 1@
|
|
$(TABLE_PREFIX)_data_get.c \
|
|
$(TABLE_PREFIX)_data_set.c \
|
|
@ end@
|
|
$(TABLE_PREFIX)_data_access.c
|
|
|
|
SRCS = $(USER_SRCS) \
|
|
$(TABLE_PREFIX).c \
|
|
$(TABLE_PREFIX)_subagent.c \
|
|
$(TABLE_PREFIX)_interface.c
|
|
|
|
USER_OBJS = \
|
|
@ if $m2c_create_fewer_files != 1@
|
|
$(TABLE_PREFIX)_data_get.o \
|
|
$(TABLE_PREFIX)_data_set.o \
|
|
@ end@
|
|
$(TABLE_PREFIX)_data_access.o
|
|
|
|
OBJS = $(USER_OBJS) \
|
|
$(TABLE_PREFIX).o \
|
|
$(TABLE_PREFIX)_subagent.o \
|
|
$(TABLE_PREFIX)_interface.o
|
|
|
|
TARGETS=$(TABLE_PREFIX)
|
|
|
|
.SUFFIXES:
|
|
.SUFFIXES: .c .o .deps
|
|
|
|
|
|
all: $(TARGETS)
|
|
|
|
user: $(USER_OBJS)
|
|
|
|
$(TARGETS): $(LIB_DEPS)
|
|
|
|
$(TABLE_PREFIX): $(OBJS) $(TABLE_PREFIX)_Makefile
|
|
$(CC) -o $(TABLE_PREFIX) $(OBJS) $(LIBS)
|
|
|
|
clean:
|
|
rm -f $(OBJS) $(TARGETS)
|
|
|
|
@if "$mfd_netsnmp_dir" ne ""@
|
|
|
|
$(TABLE_PREFIX).deps $(TABLE_PREFIX)_subagent.deps $(TABLE_PREFIX)_interface.deps: $(TABLE_PREFIX)_Makefile
|
|
$(TABLE_PREFIX)_data_access.deps: $(TABLE_PREFIX)_Makefile
|
|
@if $m2c_create_fewer_files != 1@
|
|
$(TABLE_PREFIX)_data_get.deps: $(TABLE_PREFIX)_Makefile
|
|
$(TABLE_PREFIX)_data_set.deps: $(TABLE_PREFIX)_Makefile
|
|
@end@
|
|
|
|
%.deps : %.c
|
|
\@echo "Generating makefile $\@ ..."
|
|
\@set -e; $(CC) -M $(COPTS) $(CFLAGS) $(CPPFLAGS) $< \
|
|
| sed 's/\($*\)\.o[ :]*/\1.o $\@ : /g' > $\@; \
|
|
[ -s $\@ ] || $(RM) $(RMFLAGS) $\@
|
|
|
|
include $(TABLE_PREFIX).deps
|
|
include $(TABLE_PREFIX)_subagent.deps
|
|
include $(TABLE_PREFIX)_interface.deps
|
|
include $(TABLE_PREFIX)_data_access.deps
|
|
@ if $m2c_create_fewer_files != 1@
|
|
include $(TABLE_PREFIX)_data_get.deps
|
|
include $(TABLE_PREFIX)_data_set.deps
|
|
@ end@
|
|
@end@
|
|
########################################################################
|
|
@ if $m2c_mark_boundary == 1@
|
|
# END code generated by mfd-makefile.m2m
|
|
@ end@
|
|
@ end@ # not including ${name}_Makefile.m2m
|
|
@ close ${name}_Makefile@
|
|
@end@ # no existing makefile
|