#!/usr/bin/make -f
# ------------------------------------------------------------------------------
# CORAS(LNX) for VPC/Solution-ePC/EPC/LPC sample
# hardware monitor console sample
#
# Copyright (c) Since 2021 CONTEC Co.,Ltd. All Rights reserved.
# ------------------------------------------------------------------------------

MANUFACTURER_NAME = CONTEC
TARGET_MODELS = GMB-MQ37000 VPC-5000 GMB-AW48000 GMB-IW48000 LPC-400 GMB-MQ67000

MANUFACTURER ?= $(shell echo -n `cat /sys/devices/virtual/dmi/id/sys_vendor`)
PRODUCT_NAME ?= $(shell echo -n `cat /sys/devices/virtual/dmi/id/product_name`)
# PRODUCT_NAME "-" removed
PRODUCT_NAME_OPT ?= $(shell echo -n ${PRODUCT_NAME} | sed 's/-//g')

#Check Manufacturer
ifeq ($(filter $(shell echo -n ${MANUFACTURER}), $(MANUFACTURER_NAME)),)
$(error "This Product is not supported!")
endif
#Check Product name
ifeq ($(filter $(shell echo -n ${PRODUCT_NAME}), $(TARGET_MODELS)),)
$(error "This Product is not supported!")
endif

CC = gcc
CFLAGS += -D$(PRODUCT_NAME_OPT)
LDLIBS += -lmtdll -lcoraslib
OBJS = hwmon.o

all:$(OBJS)
	$(CC) $(CFLAGS) $^ -o hwmon $(LDLIBS)
clean:
	rm -f *.o hwmon
