use only one getconf header

this simplifies the getconf.sh script and handling parallel make
This commit is contained in:
Evan Gates 2016-10-03 15:55:22 -07:00 committed by FRIGN
parent 96ccf5172d
commit de28c8bfa7
3 changed files with 14 additions and 31 deletions

View File

@ -205,10 +205,10 @@ $(LIBUTIL): $(LIBUTILOBJ)
$(AR) rc $@ $? $(AR) rc $@ $?
$(RANLIB) $@ $(RANLIB) $@
getconf.c: confstr_l.h limits_l.h sysconf_l.h pathconf_l.h getconf.o: getconf.h
confstr_l.h limits_l.h sysconf_l.h pathconf_l.h: getconf.sh getconf.h: getconf.sh
./getconf.sh ./getconf.sh > $@
install: all install: all
mkdir -p $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
@ -234,7 +234,7 @@ dist: clean
sbase-box: $(LIB) $(SRC) sbase-box: $(LIB) $(SRC)
mkdir -p build mkdir -p build
cp $(HDR) build cp $(HDR) build
cp confstr_l.h limits_l.h sysconf_l.h pathconf_l.h build cp getconf.h build
for f in $(SRC); do sed "s/^main(/$$(echo "$${f%.c}" | sed s/-/_/g)_&/" < $$f > build/$$f; done for f in $(SRC); do sed "s/^main(/$$(echo "$${f%.c}" | sed s/-/_/g)_&/" < $$f > build/$$f; done
echo '#include <libgen.h>' > build/$@.c echo '#include <libgen.h>' > build/$@.c
echo '#include <stdio.h>' >> build/$@.c echo '#include <stdio.h>' >> build/$@.c
@ -270,7 +270,7 @@ sbase-box-uninstall: uninstall
clean: clean:
rm -f $(BIN) $(OBJ) $(LIB) sbase-box sbase-$(VERSION).tar.gz rm -f $(BIN) $(OBJ) $(LIB) sbase-box sbase-$(VERSION).tar.gz
rm -f confstr_l.h limits_l.h sysconf_l.h pathconf_l.h rm -f getconf.h
.PHONY: .PHONY:
all install uninstall dist sbase-box sbase-box-install sbase-box-uninstall clean all install uninstall dist sbase-box sbase-box-install sbase-box-uninstall clean

View File

@ -12,22 +12,7 @@ struct var {
long v; long v;
}; };
static const struct var pathconf_l[] = { #include "getconf.h"
#include "pathconf_l.h"
};
static const struct var sysconf_l[] = {
#include "sysconf_l.h"
};
static const struct var confstr_l[] = {
#include "confstr_l.h"
};
static const struct var limits_l[] = {
#include "limits_l.h"
};
void void
usage(void) usage(void)

View File

@ -1,14 +1,12 @@
#!/bin/sh #!/bin/sh
ifdef() ifdef() {
{ printf 'static const struct var %s[] = {\n' "$1"
awk '{printf("#ifdef %s\n"\ awk '{printf("#ifdef %s\n\t{\"%s\",\t%s},\n#endif\n", $2, $1, $2)}'
"\t{\"%s\",\t%s},\n"\ echo '};'
"#endif\n", $2, $1, $2)}' > $1
} }
cat <<! | ifdef confstr_l
cat <<! | ifdef confstr_l.h
PATH _CS_PATH PATH _CS_PATH
POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS
POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
@ -28,7 +26,7 @@ POSIX_V7_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
V7_ENV _CS_V7_ENV V7_ENV _CS_V7_ENV
! !
cat <<! | ifdef limits_l.h cat <<! | ifdef limits_l
_POSIX_CLOCKRES_MIN _POSIX_CLOCKRES_MIN _POSIX_CLOCKRES_MIN _POSIX_CLOCKRES_MIN
_POSIX_AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX
_POSIX_AIO_MAX _POSIX_AIO_MAX _POSIX_AIO_MAX _POSIX_AIO_MAX
@ -74,7 +72,7 @@ _POSIX2_LINE_MAX _POSIX2_LINE_MAX
_POSIX2_RE_DUP_MAX _POSIX2_RE_DUP_MAX _POSIX2_RE_DUP_MAX _POSIX2_RE_DUP_MAX
! !
cat <<! | ifdef sysconf_l.h cat <<! | ifdef sysconf_l
AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX
AIO_MAX _SC_AIO_MAX AIO_MAX _SC_AIO_MAX
AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX
@ -195,7 +193,7 @@ _XOPEN_UUCP _SC_XOPEN_UUCP
_XOPEN_VERSION _SC_XOPEN_VERSION _XOPEN_VERSION _SC_XOPEN_VERSION
! !
cat <<! | ifdef pathconf_l.h cat <<! | ifdef pathconf_l
FILESIZEBITS _PC_FILESIZEBITS FILESIZEBITS _PC_FILESIZEBITS
LINK_MAX _PC_LINK_MAX LINK_MAX _PC_LINK_MAX
MAX_CANON _PC_MAX_CANON MAX_CANON _PC_MAX_CANON