> You can['t?] have a configure substitution in _SOURCES.  I know this seems
> wrong.  It is unfortunate that 1.4 doesn't complain about this (1.5
> will).

Why is that?  Can it be fixed?

> Instead you have to play tricks with _LDADD if you want to go the
> configure substitution route.

I wasn't able to get that to work with my setup...

> How big are your Makefiles?  How many?  Is there a way to solve the
> performance problem?  Conditionals are the easiest way to go from the
> maintenance perspective (in most cases, imho, etc).

I have one Makefile that uses conditionals. It is a 1200 byte Makefile.am
which expands to a 3MB Makefile.in.  I'm supporting 7 different platforms,
by copying the appropriate system dependent files into the current directory
and then using the appropriate files in the compilation.

When I build, I only want the platform dependent files built.  When I build
a distribution, I want all files to be distributed.

I'm attaching my Makefile.am.

Thanks!
        -Sam Lantinga, Lead Programmer, Loki Entertainment Software

## Makefile.am for the SDL audio library

noinst_LTLIBRARIES = libaudio.la

ARCH_SUBDIRS = beos irix linux solaris win32 macos aix

if TARGET_LINUX
LINUX_ARCH_SRCS = SDL_audiodev.c SDL_audiodev_c.h \
                  SDL_esdaudio.c SDL_esdaudio.h \
                  SDL_dmaaudio.c SDL_dmaaudio.h \
                  SDL_dspaudio.c SDL_dspaudio.h
else
LINUX_ARCH_SRCS = 
endif

if TARGET_SOLARIS
SOLARIS_ARCH_SRCS = SDL_audiodev.c SDL_audiodev_c.h \
                    SDL_esdaudio.c SDL_esdaudio.h \
                    SDL_lowaudio.h SDL_sysaudio.c
else
SOLARIS_ARCH_SRCS = 
endif

if TARGET_IRIX
IRIX_ARCH_SRCS = SDL_lowaudio.h SDL_sysaudio.c
else
IRIX_ARCH_SRCS = 
endif

if TARGET_FREEBSD
FREEBSD_ARCH_SRCS = SDL_audiodev.c SDL_audiodev_c.h \
                    SDL_esdaudio.c SDL_esdaudio.h \
                    SDL_dspaudio.c SDL_dspaudio.h
else
FREEBSD_ARCH_SRCS = 
endif

if TARGET_OPENBSD
OPENBSD_ARCH_SRCS = SDL_audiodev.c SDL_audiodev_c.h \
                    SDL_esdaudio.c SDL_esdaudio.h \
                    SDL_dspaudio.c SDL_dspaudio.h
else
OPENBSD_ARCH_SRCS = 
endif

if TARGET_WIN32
if USE_DIRECTX
WIN32_ARCH_SRCS = SDL_dibaudio.h SDL_dibaudio.c SDL_dx5audio.h SDL_dx5audio.c
else
WIN32_ARCH_SRCS = SDL_dibaudio.h SDL_dibaudio.c
endif
else
WIN32_ARCH_SRCS = 
endif

if TARGET_BEOS
BEOS_ARCH_SRCS = SDL_lowaudio.h SDL_beaudio.cc
else
BEOS_ARCH_SRCS = 
endif

if TARGET_MACOS
MACOS_ARCH_SRCS = SDL_romaudio.h SDL_romaudio.c
else
MACOS_ARCH_SRCS = 
endif

if TARGET_AIX
AIX_ARCH_SRCS = SDL_audiodev.c SDL_audiodev_c.h \
                SDL_paudio.c SDL_paudio.h
else
AIX_ARCH_SRCS = 
endif

# Include the architecture-independent sources
COMMON_SRCS =                   \
        SDL_audio.c             \
        SDL_audio_c.h           \
        SDL_audiocvt.c          \
        SDL_audiomem.c          \
        SDL_audiomem.h          \
        SDL_mixer.c             \
        SDL_sysaudio.h          \
        SDL_wave.c              \
        SDL_wave.h

# Include the architecture-specific sources
ARCH_SRCS =                     \
        $(LINUX_ARCH_SRCS)      \
        $(SOLARIS_ARCH_SRCS)    \
        $(IRIX_ARCH_SRCS)       \
        $(FREEBSD_ARCH_SRCS)    \
        $(OPENBSD_ARCH_SRCS)    \
        $(WIN32_ARCH_SRCS)      \
        $(BEOS_ARCH_SRCS)       \
        $(MACOS_ARCH_SRCS)      \
        $(AIX_ARCH_SRCS)

libaudio_la_SOURCES = $(COMMON_SRCS) $(ARCH_SRCS)

## Let automake know that it shouldn't distribute linked sources
BUILT_SOURCES = $(ARCH_SRCS)

## Let automake know that it should remove these for distribution
DISTCLEANFILES = $(ARCH_SRCS)

# The architecture specific directories need to be copied into place
# when building a distribution.
dist-hook:
        (cd $(distdir) && rm -f $(BUILT_SOURCES))
        cp -rp $(ARCH_SUBDIRS) $(distdir)
        (cd $(distdir) && rm -rf `find . -name CVS`)

Reply via email to