I am trying to write an application that needs ALSA or OSS headers. Basically, I want to pass the definition to the compiler if /etc/oss.conf does not exist, since this probably means that the soundcard.h header does not exist (feel free to correct me on this, I'm still new to working with OSS) . In the OSS documentation, you should use the include directive like this:
include /etc/oss.conf CFLAGS := -I$(OSSLIBDIR)/include/sys
One problem. OSS support is optional, so I want to check if the header exists, and if so, pass the definition to the compiler. The problem is that AFAIK cannot check if the file exists outside the make rule of the file. Inside the rule, if I use the if statement, for some reason, trying to install CFLAGS does not change it:
test: $(objects) @if [ -f ${OSS_CONFIG} ]; then \ . ${OSS_CONFIG}; \ CFLAGS+=" -I${OSSLIBDIR} -DUSE_OSS"; \ fi @echo ${CFLAGS}
(The above only outputs the original CFLAGS value, even if ${OSS_CONFIG} exists.) This is of course extremely ugly, and I wonder if there is a cleaner way to do this. Or so I'm going to do it to trigger a worldwide catastrophic event related to the genocide of kittens?
Oh, and please don't tell me to use autoconf.
c open-source makefile alsa
dav
source share