74 lines
1.2 KiB
Makefile
74 lines
1.2 KiB
Makefile
# Compiler
|
|
ifeq "$(origin CC)" "default"
|
|
COLORGCC := $(shell which colorgcc >/dev/null 2>&1 ; echo $$?)
|
|
ifeq "$(COLORGCC)" "0"
|
|
CC = colorgcc
|
|
endif
|
|
endif
|
|
|
|
# Other tools
|
|
AR = ar
|
|
RANLIB = ranlib
|
|
RM = rm -f
|
|
|
|
# General variables
|
|
LIB_CIBLE=libowlps-client
|
|
VERSION=1.0
|
|
|
|
# Targets to build
|
|
STATIC=$(LIB_CIBLE).a
|
|
HEADER=owlps-client.h
|
|
|
|
# Library components
|
|
OBJS=$(LIB_CIBLE).o
|
|
|
|
# Flags
|
|
LIBOWLPS_DIR = ../libowlps
|
|
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR)
|
|
#CFLAGS += -g -O0
|
|
CFLAGS += -D DEBUG
|
|
DEPFLAGS=-MMD
|
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
|
PICFLAG=-fPIC
|
|
#STRIPFLAGS= -Wl,-s
|
|
#LDFLAGS=
|
|
|
|
|
|
## Standard targets ##
|
|
|
|
.PHONY : all static clean purge help
|
|
|
|
all : static
|
|
static : $(STATIC)
|
|
|
|
%.o : %.c $(HEADER)
|
|
$(CC) $(XCFLAGS) -c $<
|
|
|
|
# Static library compilation
|
|
$(STATIC) : $(OBJS)
|
|
$(RM) $@
|
|
$(AR) cru $@ $^
|
|
$(RANLIB) $@
|
|
|
|
|
|
## Cleaning ##
|
|
|
|
clean :
|
|
@$(RM) *~ *.o *.d
|
|
|
|
purge : clean
|
|
@$(RM) $(STATIC)
|
|
|
|
|
|
## Help ##
|
|
|
|
help :
|
|
@echo "Needed libraries:"
|
|
@echo " libowlps-dev"
|
|
@echo
|
|
@echo "Targets:"
|
|
@echo " static (default target): Builds the static library."
|
|
@echo
|
|
@echo " clean: Deletes the temporary files."
|
|
@echo " purge: Deletes the built binaries."
|