40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
# 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)
|