First Commit
[librecmc/package-feed.git] / utils / open-plc-utils / Makefile
1 #
2 # Copyright (C) 2013-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=open-plc-utils
11 PKG_VERSION:=2015-09-21
12 PKG_RELEASE:=$(PKG_SOURCE_VERSION)
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://github.com/qca/open-plc-utils.git
16 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE_VERSION:=885a1b7e2e663b5ab8797db6d40a0318131fdf18
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
19
20 PKG_MAINTAINER:=Florian Fainelli <florian@openwrt.org>
21
22 PKG_LICENSE:=ISC
23 PKG_LICENSE_FILES:=LICENSE
24
25 PKG_BUILD_PARALLEL:=1
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/open-plc-utils/Default
30   SECTION:=utils
31   CATEGORY:=Utilities
32   TITLE:=Qualcomm Atheros Power Line Communication utilities
33   URL:=https://github.com/qca/open-plc-utils/blob/master/README
34 endef
35
36 define Package/open-plc-utils
37   $(call Package/open-plc-utils/Default)
38   MENU:=1
39 endef
40
41 define GenPlugin
42   define Package/$(addprefix open-plc-utils-,$(1))
43     $(call Package/open-plc-utils/Default)
44     DEPENDS:=open-plc-utils
45     TITLE:=Utility $(2) from the Open PLC utilities
46   endef
47
48    define Package/$(addprefix open-plc-utils-,$(1))/description
49      Utility $(2) from the Open PLC utilities package.
50    endef
51 endef
52
53 OPEN_PLC_UTILS_APPS:=efbu efeu efru efsu edru edsu nics \
54                      hpavkey hpavkeys rkey mac2pw mac2pwd \
55                      mdioblock mdioblock2 mdiodump mdiogen \
56                      hpav mme \
57                      chknvm chknvm2 nvmsplit nvmmerge \
58                      chkpib chkpib2 setpib getpib modpib pib2xml \
59                      pibcomp pibdump pibruin xml2pib psin psout pskey \
60                      psgraph psnotch pibrump \
61                      int6k int6kboot int6keth int6kf int6khost \
62                      int64host int6kid int6klist int6klog int6kmdio \
63                      int6kmdio2 int6kmod int6kstat int6ktest int6krate \
64                      int6krule int6ktone int6kwait CMEncrypt sada \
65                      coqos_add coqos_info coqos_man coqos_mod coqos_rel \
66                      mdustats ampboot amphost ampID amplist amprate \
67                      ampstat amptest amptool amptone ampwait \
68                      plcboot plchost plcID plclist plcrate plcrule \
69                      plcstat plctest plctool plctone \
70                      plcwait plchostd plcget plcset plcotst plcfwd \
71                      plcdevs plclog plcmdio16 plcmdio32 \
72                      config2cfg sdram \
73                      int6kuart int6kbaud ttysig ptsctl weeder ttysend \
74                      ttyrecv ttycat int6kdetect
75
76 $(foreach a,$(OPEN_PLC_UTILS_APPS),$(eval $(call GenPlugin,$(a))))
77
78 ifdef CONFIG_USE_MUSL
79   TARGET_CFLAGS += -D__UCLIBC__
80 endif
81
82 define Build/Compile
83         $(MAKE) -C $(PKG_BUILD_DIR) \
84                 EXTRA_CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
85                 LDFLAGS="$(TARGET_CFLAGS) $(TARGET_LDFLAGS)" \
86                 CROSS="$(TARGET_CROSS)" \
87                 ROOTFS="$(PKG_INSTALL_DIR)" \
88                 OWNER="$(shell id -u $(shell whoami))" \
89                 GROUP="$(shell id -g $(shell whoami))" \
90                 all install
91 endef
92
93 define Package/open-plc-utils/install
94         true
95 endef
96
97 define BuildPlugin
98   define Package/$(1)/install
99         $(INSTALL_DIR) $$(1)/usr/bin
100         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/local/bin/$(subst open-plc-utils-,,$(1)) \
101                 $$(1)/usr/bin/
102   endef
103
104   $$(eval $$(call BuildPackage,$(1)))
105 endef
106
107 $(eval $(call BuildPackage,open-plc-utils))
108 $(foreach a,$(OPEN_PLC_UTILS_APPS),$(eval $(call BuildPlugin,open-plc-utils-$(a))))