feat: add lib-version
parent
dd56a9cd5b
commit
9130887d03
|
@ -0,0 +1,9 @@
|
|||
#include <stdio.h>
|
||||
#include <libpq-fe.h>
|
||||
int main() {
|
||||
int lib_ver = PQlibVersion();
|
||||
printf("Version of libpq: %d\n", lib_ver);
|
||||
printf("Version of libpq: %d\n", lib_ver);
|
||||
printf("Version of libpq: %d\n", lib_ver);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
# Docu
|
||||
#
|
||||
#$@ is the name of the file to be made
|
||||
#$? is the names of the changed dependents
|
||||
#$< the name of the related file that caused the action
|
||||
#$* the prefix shared by target and dependent files
|
||||
#
|
||||
# Others
|
||||
RM = /bin/rm -f
|
||||
#
|
||||
# Source, Executable, Includes, Library Defines
|
||||
EXE = main
|
||||
#
|
||||
# Compiler, Linker Defines
|
||||
CC = /usr/bin/gcc
|
||||
#
|
||||
all:
|
||||
$(CC) main.c -I/usr/include/postgresql -L/usr/lib/x86_64-linux-gnu -lpq -std=c99 -Wall -o $(EXE)
|
||||
# Clean Up Objects, Exectuables, Dumps out of source directory
|
||||
clean:
|
||||
$(RM) *.o $(EXE) *~
|
|
@ -0,0 +1,39 @@
|
|||
# Docu
|
||||
#
|
||||
#$@ is the name of the file to be made
|
||||
#$? is the names of the changed dependents
|
||||
#$< the name of the related file that caused the action
|
||||
#$* the prefix shared by target and dependent files
|
||||
#
|
||||
#CFLAGS:Extra flags to give to the C compiler
|
||||
#LDFLAGS:Extra flags to give to compilers when they are supposed to invoke the linker, `ld'.
|
||||
#
|
||||
# Source, Executable, Includes, Library Defines
|
||||
INCL =
|
||||
SRC = main.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
LIBS = -lpq
|
||||
EXE = main
|
||||
INC = -I. -I$(pg_config --includedir)
|
||||
|
||||
# Compiler, Linker Defines
|
||||
CC = /usr/bin/gcc
|
||||
CFLAGS = -std=c99 -Wall
|
||||
LIBPATH = -L. -L$(pg_config --libdir)
|
||||
LDFLAGS = -o $(EXE) $(LIBPATH) $(LIBS)
|
||||
RM = /bin/rm -f
|
||||
|
||||
# Compile and Assemble C Source Files into Object Files
|
||||
%.o: %.c
|
||||
$(CC) $(INC) $(CFLAGS) -c $*.c
|
||||
|
||||
# Link all Object Files with external Libraries into Binaries
|
||||
$(EXE): $(OBJ)
|
||||
$(CC) $(LDFLAGS) $(OBJ)
|
||||
|
||||
# Objects depend on these Libraries
|
||||
$(OBJ): $(INCL)
|
||||
|
||||
# Clean Up Objects, Exectuables, Dumps out of source directory
|
||||
clean:
|
||||
$(RM) $(OBJ) $(EXE)
|
|
@ -0,0 +1,21 @@
|
|||
# Docu
|
||||
#
|
||||
#$@ is the name of the file to be made
|
||||
#$? is the names of the changed dependents
|
||||
#$< the name of the related file that caused the action
|
||||
#$* the prefix shared by target and dependent files
|
||||
#
|
||||
# Others
|
||||
RM = /bin/rm -f
|
||||
#
|
||||
# Source, Executable, Includes, Library Defines
|
||||
EXE = main
|
||||
#
|
||||
# Compiler, Linker Defines
|
||||
CC = /usr/bin/gcc
|
||||
#
|
||||
all: main.o
|
||||
$(CC) main.c -I/usr/include/postgresql -L/usr/lib/x86_64-linux-gnu -lpq -std=c99 -Wall -o $(EXE)
|
||||
# Clean Up Objects, Exectuables, Dumps out of source directory
|
||||
clean:
|
||||
$(RM) *.o $(EXE) *~
|
|
@ -0,0 +1,21 @@
|
|||
# Docu
|
||||
#
|
||||
#$@ is the name of the file to be made
|
||||
#$? is the names of the changed dependents
|
||||
#$< the name of the related file that caused the action
|
||||
#$* the prefix shared by target and dependent files
|
||||
#
|
||||
# Others
|
||||
RM = /bin/rm -f
|
||||
#
|
||||
# Source, Executable, Includes, Library Defines
|
||||
EXE = main
|
||||
#
|
||||
# Compiler, Linker Defines
|
||||
CC = /usr/bin/gcc
|
||||
#
|
||||
all:
|
||||
$(CC) main.c -I/usr/include/postgresql -L/usr/lib/x86_64-linux-gnu -lpq -std=c99 -Wall -o $(EXE)
|
||||
# Clean Up Objects, Exectuables, Dumps out of source directory
|
||||
clean:
|
||||
$(RM) *.o $(EXE) *~
|
|
@ -0,0 +1,5 @@
|
|||
* build instruction
|
||||
|
||||
```
|
||||
gcc -o main main.c -I/usr/include/postgresql -L/usr/lib/x86_64-linux-gnu -lpq -std=c99
|
||||
```
|
Loading…
Reference in New Issue