add rinterpolate-config

parent 3998c3b0
......@@ -30,6 +30,8 @@ librinterpolate: $(OBJECTS)
ar rcs librinterpolate.a $(OBJECTS)
# make test executable
$(CC) $(CFLAGS) $(REQCFLAGS) -D__TEST_RINTERPOLATE__ test_rinterpolate.c -o test_rinterpolate -lc -lm -ldl $(OBJECTS) -lm
# make config
$(CC) $(CFLAGS) -D__CONFIG__ -g '-DDESTDIR="$(DESTDIR)"' '-DPREFIX="$(PREFIX)"' rinterpolate-config.c -o rinterpolate-config
# clean objects and shared libraries
clean:
......@@ -45,4 +47,7 @@ install:
install -m 644 rinterpolate.h $(DESTDIR)$(PREFIX)/include
install -m 644 rinterpolate_prototypes.h $(DESTDIR)$(PREFIX)/include
install -m 644 rinterpolate_compiler.h $(DESTDIR)$(PREFIX)/include
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 rinterpolate-config $(DESTDIR)$(PREFIX)/bin
#ifdef __CONFIG__
#include <stdio.h>
#include <stdlib.h>
#include "rinterpolate.h"
#include "rinterpolate_internal.h"
static void help(void);
int main (int argc,
char ** argv)
{
if(argc>1)
{
char *c = *(argv+1);
while(*c == '-')
{
c++;
}
if(strncmp(c,"prefix",6)==0)
{
printf("%s\n",PREFIX);
}
else if(strncmp(c,"destdir",7)==0)
{
printf("%s\n",DESTDIR);
}
else if(strncmp(c,"libs",4)==0)
{
printf("-L%s%s/%s\n",DESTDIR,PREFIX,"lib");
}
else if(strncmp(c,"cflags",6)==0)
{
printf("-I%s%s/%s\n",DESTDIR,PREFIX,"include");
}
else if(strncmp(c,"version",7)==0)
{
printf("%s\n",RINTERPOLATE_VERSION);
}
else
{
help();
}
}
else
{
help();
}
exit(0);
}
static void help(void)
{
printf("Usage:\n\nrinterpolate-config <flags>\n\nwhere <flags> are:\n\n--prefix : show PREFIX\n--destdir : show DESTDIR\n--libs : show linker information\n--cflags : show compiler flags\n--version : show librinterpolate version\n\n\n");
}
#endif//__CONFIG__
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment