mirror of
https://git.kappach.at/lda/Parsee.git
synced 2025-05-12 21:13:46 +02:00
89 lines
2.6 KiB
Makefile
89 lines
2.6 KiB
Makefile
# Makefile for building Parsee
|
|
# ================================
|
|
# TODO: Consider making something akin to a configure script that checks
|
|
# for dependencies, or maybe even use *autoconf* (the devil!)
|
|
|
|
|
|
# =========================== Parsee Flags =============================
|
|
|
|
# phantasmagoria - test runs without an actual code
|
|
CODE=phantasmagoria
|
|
NAME=Parsee
|
|
VERSION=0.0.0
|
|
|
|
REPOSITORY=$(shell git remote get-url origin)
|
|
|
|
# =========================== Compilation Flags ============================
|
|
CYTO_INC ?=/usr/local/include/ # Where Cytoplasm's include path is
|
|
# located.
|
|
CYTO_LIB ?=/usr/local/lib # Where's Cytoplasm's library is
|
|
# located.
|
|
PREFIX ?=/usr/local
|
|
|
|
SOURCE=src
|
|
OBJECT=build
|
|
AYAS=ayaya
|
|
ETC=etc
|
|
INCLUDES=src/include
|
|
CC=cc
|
|
CFLAGS=-I$(SOURCE) -I$(INCLUDES) -I$(CYTO_INC) -DNAME="\"$(NAME)\"" -DVERSION="\"$(VERSION)\"" -DREPOSITORY=\"$(REPOSITORY)\" -DCODE=\"$(CODE)\" -g -ggdb -Wall -Werror
|
|
LDFLAGS=-L $(CYTO_LIB) -lCytoplasm -g -ggdb
|
|
AFLAGS=-C "$(ETC)/ayadoc/style.css" -p "$(NAME)"
|
|
BINARY=parsee
|
|
# ============================ Compilation =================================
|
|
SRC_FILES:=$(shell find $(SOURCE) -name '*.c')
|
|
OBJ_FILES:=${subst $(SOURCE)/,$(OBJECT)/,$(patsubst %.c, %.o, $(SRC_FILES))}
|
|
|
|
CPP_FILES:=$(shell find $(INCLUDES) -name '*.h')
|
|
AYA_FILES:=${subst $(INCLUDES)/,$(AYAS)/,$(patsubst %.h, %.html, $(CPP_FILES))}
|
|
|
|
all: binary utils
|
|
|
|
binary: $(OBJ_FILES)
|
|
$(CC) $(LDFLAGS) $(OBJ_FILES) -o $(BINARY)
|
|
|
|
clean:
|
|
rm -rf $(OBJECT) $(BINARY) $(AYAS)
|
|
|
|
$(OBJECT)/%.o: $(SOURCE)/%.c
|
|
@mkdir -p $(shell dirname "$@")
|
|
$(CC) -c $(CFLAGS) $< -o $@
|
|
|
|
utils:
|
|
(cd tools && make)
|
|
|
|
ayadoc: utils $(AYA_FILES)
|
|
|
|
$(AYAS)/%.html: $(INCLUDES)/%.h
|
|
@mkdir -p $(shell dirname "$@")
|
|
tools/out/aya $(AFLAGS) -i $< -o $@
|
|
|
|
|
|
# Installs everything.
|
|
install: binary utils ayadoc install_setup install_parsee install_tools install_aya install_man
|
|
@echo Installed $(NAME) to $(PREFIX)!
|
|
|
|
install_setup:
|
|
install -dm755 "$(PREFIX)/bin"
|
|
install -dm755 "$(PREFIX)/share/doc"
|
|
install -dm755 "$(PREFIX)/man"
|
|
|
|
install_parsee:
|
|
install -Dm755 "$(BINARY)" "$(PREFIX)/bin/$(BINARY)"
|
|
|
|
TOOLS:=$(shell find 'tools/out' -name '*')
|
|
ITOOL:=${subst tools/out/,$(PREFIX)/bin/,$(patsubst tools/out/%, tools/out/$(BINARY)-%, $(TOOLS))}
|
|
install_tools: $(ITOOL)
|
|
$(PREFIX)/bin/$(BINARY)-%: tools/out/%
|
|
install -Dm755 "$<" "$@"
|
|
|
|
IHTML:=${subst $(AYAS)/,$(PREFIX)/share/doc/$(BINARY)/,$(AYA_FILES)}
|
|
install_aya: $(IHTML)
|
|
$(PREFIX)/share/doc/$(BINARY)/%: $(AYAS)/%
|
|
install -Dm644 "$<" "$@"
|
|
|
|
MPAGE:=$(shell find 'etc/man' -name '*.*')
|
|
PPAGE:=${subst etc/man/,$(PREFIX)/man/,$(MPAGE)}
|
|
install_man: $(PPAGE)
|
|
$(PREFIX)/man/%: etc/man/%
|
|
install -Dm644 "$<" "$@"
|