| 1 |
# $Id: Makefile 22718 2011-08-04 19:23:21Z rubidium $ |
| 2 |
|
| 3 |
# ========================================================= |
| 4 |
# Makefile for the catcodec program |
| 5 |
# |
| 6 |
# Don't put any local configuration in here |
| 7 |
# Change Makefile.local instead, it'll be |
| 8 |
# preserved when updating the sources |
| 9 |
# ========================================================= |
| 10 |
# |
| 11 |
# catcodec 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, version 2. |
| 12 |
# catcodec 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. |
| 13 |
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with catcodec. If not, see <http://www.gnu.org/licenses/>. |
| 14 |
|
| 15 |
ifdef VERBOSE |
| 16 |
Q = |
| 17 |
else |
| 18 |
Q = @ |
| 19 |
endif |
| 20 |
|
| 21 |
|
| 22 |
ROOT_DIR := $(shell pwd) |
| 23 |
PACKAGE_NAME = catcodec |
| 24 |
|
| 25 |
-include Makefile.local |
| 26 |
|
| 27 |
AWK ?= "awk" |
| 28 |
BUNDLE_DIR ?= "$(ROOT_DIR)/bundle" |
| 29 |
BUNDLES_DIR ?= "$(ROOT_DIR)/bundles" |
| 30 |
CATCODEC ?= catcodec$(EXTENSION) |
| 31 |
CXXFLAGS ?= -Wall -Wcast-qual -Wwrite-strings |
| 32 |
OS ?= unknown |
| 33 |
|
| 34 |
|
| 35 |
OBJS = catcodec.o io.o sample.o rev.o |
| 36 |
|
| 37 |
# Regardless of the warning settings, we really do not want these errors. |
| 38 |
CXXFLAGS += -Wno-multichar |
| 39 |
ifdef DEBUG |
| 40 |
CXXFLAGS += -g -ggdb |
| 41 |
endif |
| 42 |
|
| 43 |
all: $(CATCODEC) |
| 44 |
|
| 45 |
objs/%.o: src/%.cpp |
| 46 |
$(Q)mkdir -p objs |
| 47 |
@echo '[CPP] $@' |
| •48 |
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< |
| 49 |
|
| 50 |
$(CATCODEC): $(OBJS:%=objs/%) |
| 51 |
@echo '[LINK] $@' |
| 52 |
$(Q)$(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) $^ |
| 53 |
|
| 54 |
VERSION := $(shell ./findversion.sh | cut -f 1 -d' ') |
| 55 |
RES := $(shell if [ "`cat version.cache 2>/dev/null`" != "$(VERSION)" ]; then echo "$(VERSION)" > version.cache; fi ) |
| 56 |
|
| 57 |
src/rev.cpp: version.cache src/rev.cpp.in |
| 58 |
$(Q)cat src/rev.cpp.in | sed "s@\!\!VERSION\!\!@$(VERSION)@g" > src/rev.cpp |
| 59 |
|
| 60 |
clean: |
| 61 |
@echo '[CLEAN]' |
| •62 |
$(Q)rm -f $(CATCODEC) src/rev.cpp version.cache |
| 63 |
$(Q)rm -rf objs |
| 64 |
|
| 65 |
mrproper: clean |
| 66 |
$(Q)rm -rf $(BUNDLE_DIR) $(BUNDLES_DIR) |
| 67 |
|
| 68 |
include Makefile.bundle |