Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions support #66

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,12 @@
bin/
*.swp
log/

# Files created by configure
/config.cache
/config.log
/config.status
/Makefile
/Makefile.global
/src/include/paths.h
/src/include/build.h
70 changes: 0 additions & 70 deletions Makefile

This file was deleted.

18 changes: 18 additions & 0 deletions Makefile.global.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
bindir ?= @bindir@
includedir ?= @includedir@/@PACKAGE_NAME@
contribdir ?= @libdir@/@PACKAGE_NAME@
mandir ?= @mandir@
man1dir = $(mandir)/man1
man5dir = $(mandir)/man5
docdir ?= @docdir@/@PACKAGE_NAME@

CC = @CC@
LD = @CC@
INSTALL ?= install -D
PTHREAD_LIB = @PTHREAD_LIB@

CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
72 changes: 72 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
include Makefile.global

LIBS=@LIBS@

CPPFLAGS = -Isrc/include
LDFLAGS += -Wl,-E

OBJDIR = obj
OUT = bin/schaufel

SOURCES = $(wildcard src/*.c) $(wildcard src/utils/*.c)
TEST_SOURCES = $(wildcard t/*.c)

OBJ = $(patsubst src/%.c, $(OBJDIR)/%.o, $(SOURCES))
OBJ_TEST = $(patsubst $(OBJDIR)/main.o, ,$(OBJ))
OBJ_BIN_TEST = $(patsubst t/%.c, $(OBJDIR)/%.o, $(TEST_SOURCES))

DOCS = $(patsubst man/%, doc/%.pdf , $(wildcard man/*))

all: release

contrib:
$(MAKE) -C contrib

docs: $(DOCS)

doc/%.pdf: man/*
groff -mandoc -f H -T ps $^ | ps2pdf - $@

release: before_release src/include/paths.h $(OBJ) out_release

test: clean_release before_release $(OBJ_TEST) $(OBJ_BIN_TEST)

before_release:
mkdir -p obj/utils bin

clean: clean_release clean_paths

clean_release:
rm -f $(OBJ) $(OUT)
rm -rf bin
rm -rf $(OBJDIR)
rm -rf doc/*.pdf

clean_paths:
rm -f src/include/paths.h

out_release: $(OBJ)
$(LD) $(LIBDIR) $(LDFLAGS) $(OBJ) $(LIBS) -o $(OUT)

$(OBJDIR)/%.o: src/%.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

$(OBJDIR)/%.o: t/%.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(LD) $(LIBDIR) $(OBJ_TEST) $@ $(LIBS) -o bin/$(subst .o, ,$(notdir $@))
valgrind -q --leak-check=full bin/$(subst .o, ,$(notdir $@))

install: all
$(INSTALL) bin/schaufel $(DESTDIR)$(bindir)/schaufel
cp -r src/include/ $(DESTDIR)$(includedir)
$(INSTALL) -m 0644 contrib.mk $(DESTDIR)$(contribdir)/contrib.mk
$(INSTALL) -m 0644 Makefile.global $(DESTDIR)$(contribdir)/Makefile.global
$(INSTALL) -m 0644 -t $(DESTDIR)$(docdir) doc/*
$(INSTALL) -m 0644 man/schaufel.1 $(DESTDIR)$(man1dir)/schaufel.1
$(INSTALL) -m 0644 man/schaufel.conf.5 $(DESTDIR)$(man5dir)/schaufel.conf.5

src/include/paths.h:
echo "#define INCLUDEDIR \"$(includedir)\"" >$@
echo "#define CONTRIBDIR \"$(contribdir)\"" >>$@

.PHONY: all contrib docs release test clean
Loading