Implement new Makefile as well as clean up source code
This commit is contained in:
54
Makefile
54
Makefile
@@ -1,3 +1,11 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
|
||||
IDIR = ./include
|
||||
BDIR = ./build
|
||||
SDIR = ./src
|
||||
|
||||
include config.mk
|
||||
|
||||
all:
|
||||
@@ -8,27 +16,45 @@ 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:
|
||||
install build/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
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user