Skip to content

Commit

Permalink
Prefer inclusion over creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddieantonio committed May 8, 2017
1 parent 8e6b72b commit e25d715
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ imgcat
/config.log
/config.status
/configure
/Makefile
config.mk
43 changes: 16 additions & 27 deletions Makefile.in → Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,7 @@ PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1

# Programs
CC = @CC@
CXX = @CXX@
LD = @CXX@

# Define magic make variables (see: make --print-database)
CFLAGS ?= -Wall -Werror
CXXFLAGS ?= -Wall -Werror
# the -M* options produce .d files in addition to .o files,
# to keep track of header dependencies (see: $(DEPS)).
# TODO: use configure's --enable-tracking or whatever
OUTPUT_OPTION = -MMD -MP -o $@
include config.mk

# TODO: use autoconf to figure this out.
# Use C11 and C++11 --- workarounds for older versions of GCC.
Expand All @@ -54,14 +43,6 @@ CIMG_CXXFLAGS += $(shell pkg-config --cflags libpng) -Dcimg_use_png
LDLIBS += $(shell pkg-config --libs libpng)
endif

# Always link with libjpeg; CImg requires pthread, for some reason
# TODO: augment this from autoconf
LDLIBS = -ljpeg -lm -ltermcap -lpthread

SOURCES = $(wildcard src/*.c) $(wildcard src/*.cc)
OBJS = $(addsuffix .o,$(basename $(SOURCES)))
DEPS = $(OBJS:.o=.d)

# Enable optimizations in production mode.
# TODO: do something about this...?
ifdef production
Expand All @@ -72,8 +53,20 @@ CFLAGS += -g
CXXFLAGS += -g
endif

PANDOC = @PANDOC@
PANDOCFLAGS =
# Add any special flags for CImg
# TODO: Create a cimg_config.h
#load_image.o: CXXFLAGS += $(CIMG_CXXFLAGS) -Dcimg_use_jpeg
#load_image.o:

# Always link with libjpeg; CImg requires pthread, for some reason
# TODO: augment this from autoconf
LDLIBS = -ljpeg -lm -ltermcap -lpthread

# Get the source files.
SOURCES = $(wildcard src/*.c) $(wildcard src/*.cc)
OBJS = $(addsuffix .o,$(basename $(SOURCES)))
DEPS = $(OBJS:.o=.d)


all: $(BIN) $(MAN)

Expand All @@ -85,14 +78,10 @@ install: $(BIN) $(MAN)
test: $(BIN)
tests/run $<

-include $(DEPS)

clean:
$(RM) $(BIN) $(OBJS)

# Add any special flags for CImg
#load_image.o: CXXFLAGS += $(CIMG_CXXFLAGS) -Dcimg_use_jpeg
#load_image.o:
-include $(DEPS)


$(BIN): $(OBJS)
Expand Down
35 changes: 35 additions & 0 deletions config.mk.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2017 Eddie Antonio Santos <easantos@ualberta.ca>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Programs
CC = @CC@
CXX = @CXX@
PANDOC = @PANDOC@
LD = @CXX@
# TODO: libs
LDLIBS =

# Define magic make variables (see: make --print-database)
CFLAGS ?= -Wall -Werror
CXXFLAGS ?= -Wall -Werror

# the -M* options produce .d files in addition to .o files,
# to keep track of header dependencies (see: $(DEPS)).
# TODO: provide feature: --disable-dependency-tracking
OUTPUT_OPTION = -MMD -MP -o $@
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
AC_INIT([imgcat], [2.0.0], [http://github.com/eddieantonio/imgcat/issues])
AC_CONFIG_SRCDIR([src/imgcat.c])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([config.mk])

# Checks for compilers and pandoc
AC_LANG([C++])
Expand Down

0 comments on commit e25d715

Please sign in to comment.