lw-everestlinux/feature/new-makefile #11
62
Makefile
62
Makefile
@ -1,40 +1,60 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
|
||||
IDIR = ./include
|
||||
BDIR = ./build
|
||||
SDIR = ./src
|
||||
|
||||
include config.mk
|
||||
|
||||
COLOR_GREEN=\033[0;32m
|
||||
COLOR_BLUE=\033[0;34m
|
||||
COLOR_RESET=\033[0m
|
||||
|
||||
all:
|
||||
@echo "Run 'make test' for the test binary, or 'make lib' to generate a static library."
|
||||
@echo "No make option specified."
|
||||
@echo "Run 'make help' for a full list of options."
|
||||
|
||||
help:
|
||||
@echo "Make options for libglacier:"
|
||||
@echo ""
|
||||
@echo "lib - generate the static library"
|
||||
@echo "test - generate a test binary"
|
||||
@echo "install - install the static library and header files to PREFIX"
|
||||
@echo "clean - remove all generated files"
|
||||
|
||||
test:
|
||||
deprecate:
|
||||
@echo "[WARN]"
|
||||
@echo "[WARN] This rule has been deprecated, proceed with caution."
|
||||
@echo "[WARN]"
|
||||
|
||||
test: deprecate
|
||||
$(CC) libglacier.c $(LIBFLAGS) -o libglacier.test
|
||||
cp etc/example.cfg ./glacier.cfg
|
||||
|
||||
lib:
|
||||
lib: $(SDIR)/libglacier.c
|
||||
mkdir build
|
||||
mkdir build/lib
|
||||
$(CC) libglacier.c -c $(LIBFLAGS) -o build/lib/libglacier.o
|
||||
$(AR) -rc build/lib/libglacier.a build/lib/libglacier.o
|
||||
$(CC) $(SDIR)/libglacier.c -c $(LIBFLAGS) -o $(BDIR)/lib/libglacier.o
|
||||
$(AR) -rc $(BDIR)/lib/libglacier.a build/lib/libglacier.o
|
||||
|
||||
install:
|
||||
@echo "$(COLOR_BLUE)[i]$(COLOR_RESET) Installing static library to $(PREFIX)/lib..."
|
||||
install lib/libglacier.a $(PREFIX)/lib
|
||||
install include/config.h $(PREFIX)/include/glacier
|
||||
install include/data.h $(PREFIX)/include/glacier
|
||||
install include/log.h $(PREFIX)/include/glacier
|
||||
install include/pkgops.h $(PREFIX)/include/glacier
|
||||
install include/runtime.h $(PREFIX)/include/glacier
|
||||
install include/security.h $(PREFIX)/include/glacier
|
||||
@echo "$(COLOR_GREEN)[*]$(COLOR_RESET) Finished installing static library to $(PREFIX)/lib."
|
||||
install_lib: $(BDIR)/lib/libglacier.a
|
||||
@echo "[INFO]"
|
||||
@echo "[INFO] Installing library to PREFIX/lib..."
|
||||
@echo "[INFO]"
|
||||
install $(BDIR)/lib/libglacier.a $(PREFIX)/lib
|
||||
|
||||
install_head: $(IDIR)/config.h $(IDIR)/data.h $(IDIR)/log.h $(IDIR)/pkgops.h $(IDIR)/runtime.h $(IDIR)/security.h
|
||||
@echo "[INFO]"
|
||||
@echo "[INFO] Installing header files to PREFIX/include/glacier..."
|
||||
@echo "[INFO]"
|
||||
install $(IDIR)/config.h $(PREFIX)/include/glacier
|
||||
install $(IDIR)/data.h $(PREFIX)/include/glacier
|
||||
install $(IDIR)/log.h $(PREFIX)/include/glacier
|
||||
install $(IDIR)/pkgops.h $(PREFIX)/include/glacier
|
||||
install $(IDIR)/runtime.h $(PREFIX)/include/glacier
|
||||
install $(IDIR)/security.h $(PREFIX)/include/glacier
|
||||
|
||||
install: install_lib install_head
|
||||
@echo "[INFO]"
|
||||
@echo "[INFO] Finished installing library and header files to PREFIX."
|
||||
@echo "[INFO]"
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
rm -rf $(BDIR)
|
||||
|
27
src/config.h
Normal file
27
src/config.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* config.h - Various compile-time settings for libglacier
|
||||
*
|
||||
* This file is part of Glacier.
|
||||
*
|
||||
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation, either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with Glacier. If
|
||||
* not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H_
|
||||
#define CONFIG_H_
|
||||
|
||||
/* LG_VERBOSE - whether to use verbose logging for library events or not
|
||||
*
|
||||
* 0 is false, 1 is true
|
||||
*/
|
||||
#define LG_VERBOSE 0
|
||||
|
||||
#endif
|
@ -31,7 +31,6 @@
|
||||
#include <wchar.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "include/globals.h"
|
||||
|
||||
#define BUFFER_SIZE 1024
|
||||
#define MAX_CHILDREN 64
|
Loading…
Reference in New Issue
Block a user