1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
# Network UPS Tools: models (drivers)
# directories
MODELPATH = $(INSTALLROOT)@MODELPATH@
# other definitions
CC = @CC@
CFLAGS = -I../include @CFLAGS@
PROGS = ups-trust425+625 optiups victronups ipt-anzen bestfort \
mustekups engetron powercom bestuferrups toshiba1500 \
mgeups upseyeux multilink aeg sms
# new-style main.c drivers only
PROGS2 = bestups fentonups sec apcsmart everups belkin newapc \
masterguard newpowercom cyberpower mge-ellipse tripplite \
newvictron bestferrups801-807 genericups hp
LIBDEP = @LIBOBJ@
LIBOBJ = $(LIBDEP) @NETLIBS@ @SERLIBS@
INSTALLCMD = @INSTALL@
INSTALLMODE = 0755
# DRIVER_BUILD_LIST is either "all-drivers" or a subset from configure time
DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@
all: @DRIVER_BUILD_LIST@ upsdrvctl
all-drivers: $(PROGS) $(PROGS2)
# temporary, since 'all' does $(PROGS) which has that evil *.c dependency
newmodels: $(PROGS2)
upscommon.o: upscommon.c ../include/shared.h
$(CC) $(CFLAGS) -c upscommon.c
# ==========================================================================
# These are for testing and must be built manually, since libpthread
# isn't everywhere, and I've made no real attempt at making them portable.
#
dummyups: dummyups.c upscommon.o ../include/shared.h $(LIBDEP)
$(CC) $(CFLAGS) -o $@ $@.c upscommon.o $(LIBOBJ) -lpthread
# This one no longer needs pthreads - and there was much rejoicing...
#
dummycons: dummycons.c upscommon.o ../include/shared.h $(LIBDEP)
$(CC) $(CFLAGS) -o $@ $@.c upscommon.o $(LIBOBJ)
# ==========================================================================
# Build details for separate drivers. This will go away when everything
# has been changed to the new system.
#
# Yes, it has a *.c dependency on purpose. See above.
$(PROGS): upscommon.o ../include/shared.h ../include/shared-tables.h $(LIBDEP) *.c
$(CC) $(CFLAGS) -o $@ $@.c upscommon.o $(LIBOBJ)
# ==========================================================================
# Build details for the common drivers
#
# The rules are regenerated during 'make clean' with genmb.
include Makefile.modelbuild
# ==========================================================================
# upsdrvctl: the new all-singing all-dancing driver control program
upsdrvctl: upsdrvctl.c ../common/upsconf.o ../common/parseconf.o $(LIBDEP)
$(CC) $(CFLAGS) -o upsdrvctl upsdrvctl.c ../common/upsconf.o \
../common/parseconf.o $(LIBOBJ)
# ==========================================================================
# Special case: hidups driver - needs Linux includes
#
# Not built by default.
hidups: hidups.o main.o upscommon.o ../include/shared.h ../include/shared-tables.h ../common/upsconf.o ../common/parseconf.o $(LIBDEP)
$(CC) $(CFLAGS) -o hidups hidups.o main.o upscommon.o ../common/upsconf.o ../common/parseconf.o $(LIBOBJ)
hidups.o: hidups.c
$(CC) $(CFLAGS) -c hidups.c
# ==========================================================================
# Housekeeping stuff
#
# genmb runs here so that the source always goes out the door with a
# current Makefile.modelbuild file
clean:
rm -f *~ *.o $(PROGS) $(PROGS2) dummyups dummycons Makefile.modelbuild
rm -f hidups upsdrvctl
./genmb $(PROGS2)
distclean: clean
# ==========================================================================
# Install handlers
install: all install-@DRIVER_INSTALL_TARGET@
$(INSTALLCMD) -m $(INSTALLMODE) upsdrvctl $(MODELPATH);
# Install every driver
install-all-drivers:
@for f in $(PROGS) $(PROGS2) ; do \
echo $(INSTALLCMD) -m $(INSTALLMODE) $$f $(MODELPATH); \
$(INSTALLCMD) -m $(INSTALLMODE) $$f $(MODELPATH); \
done
# Just install the drivers that were selected by the user
install-some-drivers:
@for f in $(DRIVER_BUILD_LIST) ; do \
echo $(INSTALLCMD) -m $(INSTALLMODE) $$f $(MODELPATH); \
$(INSTALLCMD) -m $(INSTALLMODE) $$f $(MODELPATH); \
done
|