configure: Add conditional platform builds
[petitboot] / discover / Makefile.am
index 1fd8d96c6001954c1620f6b5865e463146065b35..2b7c7940b051752b02d4d55d246872ea686c0dc8 100644 (file)
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 
-pkgsysconfdir = @sysconfdir@/@PACKAGE@
+sbin_PROGRAMS += discover/pb-discover
+noinst_PROGRAMS += discover/platform.ro
 
-SUBDIRS = grub2
+discover_pb_discover_SOURCES = \
+       discover/boot.c \
+       discover/boot.h \
+       discover/cdrom.c \
+       discover/cdrom.h \
+       discover/device-handler.c \
+       discover/device-handler.h \
+       discover/discover-server.c \
+       discover/discover-server.h \
+       discover/devmapper.c \
+       discover/devmapper.h \
+       discover/event.c \
+       discover/event.h \
+       discover/params.c \
+       discover/params.h \
+       discover/parser.c \
+       discover/parser.h \
+       discover/parser-conf.c \
+       discover/parser-conf.h \
+       discover/parser-utils.c \
+       discover/parser-utils.h \
+       discover/paths.c \
+       discover/paths.h \
+       discover/pb-discover.c \
+       discover/pb-discover.h \
+       discover/resource.c \
+       discover/resource.h \
+       discover/sysinfo.c \
+       discover/sysinfo.h \
+       discover/network.c \
+       discover/network.h \
+       discover/udev.c \
+       discover/udev.h \
+       discover/user-event.c \
+       discover/user-event.h \
+       discover/kboot-parser.c \
+       discover/yaboot-parser.c \
+       discover/pxe-parser.c \
+       discover/syslinux-parser.c
 
-AM_CPPFLAGS = -I$(top_srcdir)/lib $(DEFAULT_CPPFLAGS)
+discover_pb_discover_LDADD = \
+       discover/grub2/grub2-parser.ro \
+       discover/platform.ro \
+       $(core_lib) \
+       $(UDEV_LIBS)
 
-AM_CFLAGS = $(DEFAULT_CFLAGS)  \
-       -DPREFIX='"$(prefix)"' \
-       -DPKG_SHARE_DIR='"$(pkgdatadir)"' \
-       -DPKG_SYSCONF_DIR='"$(pkgsysconfdir)"' \
-       -DLOCAL_STATE_DIR='"$(localstatedir)"'
+discover_pb_discover_LDFLAGS = \
+       $(AM_LDFLAGS) \
+       $(DEVMAPPER_LIBS)
 
-EXTRA_DIST = native-parser.c
+discover_pb_discover_CPPFLAGS = \
+       $(AM_CPPFLAGS) \
+       -DLOCAL_STATE_DIR='"$(localstatedir)"' \
+       -DLOCALEDIR='"$(localedir)"' \
+       -DPKG_LIBEXEC_DIR='"$(pkglibexecdir)"' \
+       -DPKG_SHARE_DIR='"$(pkgsharedir)"' \
+       -DPKG_SYSCONF_DIR='"$(pkgsysconfdir)"'
 
-sbin_PROGRAMS = pb-discover
+discover_platform_ro_SOURCES = \
+       discover/platform.c \
+       discover/platform.h \
+       discover/ipmi.c \
+       discover/ipmi.h \
+       discover/dt.c \
+       discover/dt.h \
+       discover/hostboot.h
 
-pb_discover_SOURCES = \
-       boot.c \
-       boot.h \
-       device-handler.c \
-       device-handler.h \
-       discover-server.c \
-       discover-server.h \
-       event.c \
-       event.h \
-       file.c \
-       file.h \
-       params.c \
-       params.h \
-       parser.c \
-       parser.h \
-       parser-conf.c \
-       parser-conf.h \
-       parser-utils.c \
-       parser-utils.h \
-       paths.c \
-       paths.h \
-       pb-discover.c \
-       pb-discover.h \
-       resource.c \
-       resource.h \
-       sysinfo.c \
-       sysinfo.h \
-       network.c \
-       network.h \
-       udev.c \
-       udev.h \
-       user-event.c \
-       user-event.h \
-       kboot-parser.c \
-       yaboot-parser.c \
-       pxe-parser.c
+if PLATFORM_POWERPC
+discover_platform_ro_SOURCES += discover/platform-powerpc.c
+endif
 
-pb_discover_LDADD = $(top_builddir)/lib/libpbcore.la grub2/grub2-parser.ro
+# Build dummy last to put it at the end of the platforms section.
+discover_platform_ro_SOURCES += discover/platform-dummy.c
 
-pb_discover_LDFLAGS = -ludev
+if ENABLE_MTD
+discover_platform_ro_SOURCES += \
+       discover/hostboot.c
 
-MAINTAINERCLEANFILES = Makefile.in
+discover_platform_ro_LDFLAGS = \
+       $(core_lib) \
+       $(UDEV_LIBS)
+
+endif
+
+discover_platform_ro_CPPFLAGS = \
+       $(AM_CPPFLAGS)
+
+discover_platform_ro_LINK = \
+       $(LD) -r -o $@