pane

Termbox2 based terminal UI library
git clone git://git.dimitrijedobrota.com/pane.git
Log | Files | Refs

Makefile (1547B)


      1 # GNU Makefile for Termbox2 based display library
      2 #
      3 # Usage: make [-f path\Makefile] [DEBUG=Y] target
      4 
      5 NAME = pane
      6 CC = gcc
      7 
      8 SRC = src
      9 OBJ = obj
     10 BIN = bin
     11 INCLUDE = include
     12 LATEX = docs/latex
     13 
     14 EXCLUDE = $(SRC)/main.c
     15 
     16 SRCS=$(wildcard $(SRC)/*.c)
     17 
     18 SRCS := $(filter-out $(EXCLUDE), $(SRCS))
     19 OBJS=$(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SRCS))
     20 CFLAGS = -I$(INCLUDE)
     21 
     22 ifeq ($(DEBUG),Y)
     23 	CFLAGS += -Wall -ggdb
     24 	SRCS := $(filter-out $(SRC)/mem.c, $(SRCS))
     25 	LIB = $(OBJ)/lib$(NAME)d
     26 else
     27 	CFLAGS += -DNDEBUG
     28 	SRCS := $(filter-out $(SRC)/memchk.c, $(SRCS))
     29 	LIB = $(OBJ)/lib$(NAME)
     30 endif
     31 
     32 all: $(LIB) main
     33 
     34 $(LIB): $(OBJS)
     35 	ar crs $@.a $^
     36 
     37 main: $(OBJ)/main.o
     38 	gcc $(SRC)/main.c -o $(BIN)/main $(CFLAGS) $(LDFLAGS) -L. -l:$(LIB).a
     39 
     40 $(OBJ)/%.o: $(SRC)/%.c
     41 	$(CC) -c $< -o $@ $(CFLAGS) $(LDFLAGS)
     42 
     43 install:
     44 	install -d /usr/local/include/$(NAME)
     45 	install -p -m 644 $(INCLUDE)/* /usr/local/include/$(NAME)
     46 	install -d /usr/local/lib
     47 	install -p -m 644 $(LIB).a /usr/local/lib
     48 
     49 clean:
     50 	-$(RM) $(BIN)/main $(OBJS)
     51 
     52 help:
     53 	@echo "Termbox2 based display library"
     54 	@echo
     55 	@echo "Usage: make [-f path\Makefile] [DEBUG=Y] target"
     56 	@echo
     57 	@echo "Target rules:"
     58 	@echo "    all         - Compiles libary file [Default]"
     59 	@echo "    install     - Installs the static library and header files"
     60 	@echo "    clean       - Clean the project by removing binaries"
     61 	@echo "    help        - Prints a help message with target rules"
     62 	@echo
     63 	@echo "Optional parameters:"
     64 	@echo "    DEBUG       - Compile binary file with debug flags enabled"
     65 	@echo
     66 
     67 .PHONY: all clean help docs