#
# Copyright (c) nVidia Corporation
#
# Makefile to build Nvmixer init script
#

TARGET = nvmix-reg

INCPATH = -I../../main -I.
CFLAGS  = -g -Wall $(INCPATH)
LIBS    = -L../commonlib -lcommonlib

OBJS = \
     nvmixer-registry.o \
     $(NULL)

all: 
	$(MAKE) $(TARGET)

$(TARGET): $(OBJS)
	$(CC) -o $@ $< $(LIBS)

# Installation
TARGETDIR = /bin


# Do fake install if not root (needed for building rpms)
install:
ifeq	($(wildcard $(TARGET)), $(TARGET))
	mkdir -p $(INSTROOT)/$(TARGETDIR)
ifeq  "$(UID)" "0"
	install -b -m 755 -o root $(TARGET) $(INSTROOT)/$(TARGETDIR)
else
	install -b -m 755 $(TARGET) $(INSTROOT)/$(TARGETDIR)
endif # uid is root
endif # target

uninstall:
	rm -f $(TARGETDIR)/$(TARGET)

clean:
	rm -f *.o *~ core $(TARGET)
