dev/c/tex_parser/Makefile

147 lines
3.4 KiB
Makefile
Raw Normal View History

2011-07-11 11:58:48 +04:00
# This file is generated with smake.sh.
# You can use this make file with instruction make to
# use one of build mode: debug, profile, develop, release.
# No need to call make clean if You make with other mode,
# because the Makefile containes rules for automatically clean.
# Some usage examples:
# CFLAGS="-march=core2 -mtune=core2" make
# LDFLAGS="-lexpat" make mode=profile
# Report bugs to <mecareful@gmail.com>
2011-07-01 15:16:59 +04:00
#_________________________________
# ENVIRONMENT |
#________________________________|
CC=cc
CXX=c++
2011-07-01 15:16:59 +04:00
LIBRARIES=
2011-07-11 11:58:48 +04:00
TARGET0=tex_parser_test
TARGET= $(TARGET0)
INCLUDE1=$(HOME)/projects/include
INCLUDE2=/usr/local/include
INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2)
#________________________________________
2011-07-01 15:16:59 +04:00
# BUILD SCRIPT (don't change) |
#_______________________________________|
ifeq ($(mode),)
mode = debug
endif
ifeq ($(mode),debug)
CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion
LDFLAGS =
endif
ifeq ($(mode),profile)
CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch
LDFLAGS = -g -p
endif
ifeq ($(mode),develop)
CFLAGS += -O2 -g
LDFLAGS += -O1
endif
ifeq ($(mode),release)
CFLAGS += -O2
LDFLAGS += -O1
endif
CFLAGS += -Wall
2011-07-01 15:16:59 +04:00
LDFLAGS += -Wall $(LIBRARIES)
2011-07-11 11:58:48 +04:00
all: change_make_options $(TARGET)
ifneq ($(mode),debug)
ifneq ($(mode),profile)
ifneq ($(mode),develop)
ifneq ($(mode),release)
@echo "Invalid build mode."
2011-07-11 11:58:48 +04:00
@echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'"
@exit 1
endif
endif
endif
endif
@echo ".........................."
@echo "Building on "$(mode)" mode "
@echo "CFLAGS=$(CFLAGS)"
@echo "LDFLAGS=$(LDFLAGS)"
@echo ".........................."
2011-07-11 11:58:48 +04:00
OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~')
OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~')
OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~')
change_make_options:
ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS))
@echo CLEANING...
@make clean &>/dev/null
2011-07-11 11:58:48 +04:00
@echo MODE=$(mode) > make_options.out
@echo CFLAGS=$(CFLAGS) >> make_options.out
@echo LDFLAGS=$(LDFLAGS) >> make_options.out
endif
%.o :
2011-07-01 15:16:59 +04:00
$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
2011-07-01 15:16:59 +04:00
clean:
$(RM) *.o *.out callgrind.out.* *.gcno $(TARGET)
2011-07-11 11:58:48 +04:00
.PHONY: all change_make_options clean
2011-07-01 15:16:59 +04:00
#_________________________________
# R U L E S |
#________________________________|
2011-07-11 11:58:48 +04:00
target_objs0 = \
tex_parser_test.o \
tex_parser.o \
xalloc.o \
xerror.o \
zalloc.o \
zalloc_ext.o \
zerror.o
$(TARGET0): $(target_objs0)
$(CC) $(LDFLAGS) -o $@ $(target_objs0)
tex_parser_test.o: \
tex_parser_test.c \
tex_parser.h \
$(INCLUDE1)/xalloc.h \
$(INCLUDE1)/xerror.h \
$(INCLUDE1)/zalloc.h \
$(INCLUDE1)/zerror.h
tex_parser.o: \
tex_parser.c \
$(INCLUDE1)/c_const.h \
tex_parser.h \
tex_parser_const.h \
tex_parser_tags.h \
$(INCLUDE1)/xerror.h \
$(INCLUDE1)/zalloc.h \
$(INCLUDE1)/zalloc_ext.h \
$(INCLUDE1)/zerror.h
xalloc.o: \
$(INCLUDE1)/xalloc.c \
$(INCLUDE1)/xalloc.h \
$(INCLUDE1)/xerror.h
xerror.o: \
$(INCLUDE1)/xerror.c \
$(INCLUDE1)/xerror.h
zalloc.o: \
$(INCLUDE1)/zalloc.c \
$(INCLUDE1)/xerror.h \
$(INCLUDE1)/zalloc.h
zerror.o: \
$(INCLUDE1)/zerror.c \
$(INCLUDE1)/xerror.h \
$(INCLUDE1)/zerror.h
zalloc_ext.o: \
$(INCLUDE1)/zalloc_ext.c \
$(INCLUDE1)/zalloc.h \
$(INCLUDE1)/zalloc_ext.h
2011-07-01 15:16:59 +04:00