Makefile для tex_parser_test

This commit is contained in:
Kolan Sh 2011-07-11 11:58:48 +04:00
parent 38573cde7d
commit bc34df2a1e
2 changed files with 75 additions and 32 deletions

View File

@ -1,22 +1,31 @@
# 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>
#_________________________________
# ENVIRONMENT |
#________________________________|
CC=cc
CXX=c++
INCLUDE=-I$(HOME)/projects/include
LIBRARIES=
#-lexpat $(shell pkg-config --cflags liblist)
TARGET=tex_parser_test
TARGET0=tex_parser_test
TARGET= $(TARGET0)
INCLUDE1=$(HOME)/projects/include
INCLUDE2=/usr/local/include
INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2)
#________________________________________
# BUILD SCRIPT (don't change) |
#_______________________________________|
# Compiler flags
# if mode variable is empty, setting debug build mode
ifeq ($(mode),)
mode = debug
endif
ifeq ($(mode),debug)
CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion
LDFLAGS =
@ -37,14 +46,14 @@ endif
CFLAGS += -Wall
LDFLAGS += -Wall $(LIBRARIES)
all: change_build_mode $(TARGET)
all: change_make_options $(TARGET)
ifneq ($(mode),debug)
ifneq ($(mode),profile)
ifneq ($(mode),develop)
ifneq ($(mode),release)
@echo "Invalid build mode."
@echo "Please use 'make mode=release', 'make mode=develop' or 'make mode=debug'"
@echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'"
@exit 1
endif
endif
@ -56,12 +65,16 @@ endif
@echo "LDFLAGS=$(LDFLAGS)"
@echo ".........................."
OLD_BUILD_MODE=$(shell cat build_mode.out 2>/dev/null)
change_build_mode:
ifneq ($(mode), $(OLD_BUILD_MODE))
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
@echo $(mode) > build_mode.out
@echo MODE=$(mode) > make_options.out
@echo CFLAGS=$(CFLAGS) >> make_options.out
@echo LDFLAGS=$(LDFLAGS) >> make_options.out
endif
%.o :
@ -70,34 +83,64 @@ endif
clean:
$(RM) *.o *.out callgrind.out.* *.gcno $(TARGET)
.PHONY: all change_build_mode clean
.PHONY: all change_make_options clean
#_________________________________
# R U L E S |
#________________________________|
KOLAN_PROJECTS=$(HOME)/projects
KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include
target_objs0 = \
tex_parser_test.o \
tex_parser.o \
xalloc.o \
xerror.o \
zalloc.o \
zalloc_ext.o \
zerror.o
target_objs = tex_parser_test.o tex_parser.o \
zalloc_ext.o zalloc.o xalloc.o zerror.o xerror.o
$(TARGET): $(target_objs)
$(CC) $(LDFLAGS) -o $@ $(target_objs)
$(TARGET0): $(target_objs0)
$(CC) $(LDFLAGS) -o $@ $(target_objs0)
tex_parser_test.o: tex_parser_test.c tex_parser.c tex_parser.h tex_parser_const.h \
$(KOLAN_INCLUDE)/xerror.h $(KOLAN_INCLUDE)/zerror.h \
$(KOLAN_INCLUDE)/xalloc.h $(KOLAN_INCLUDE)/zalloc.h $(KOLAN_INCLUDE)/zalloc_ext.h
tex_parser.o: tex_parser.c tex_parser.h tex_parser_const.h \
$(KOLAN_INCLUDE)/xerror.h $(KOLAN_INCLUDE)/zerror.h \
$(KOLAN_INCLUDE)/xalloc.h $(KOLAN_INCLUDE)/zalloc.h $(KOLAN_INCLUDE)/zalloc_ext.h
tex_parser_test.o: \
tex_parser_test.c \
tex_parser.h \
$(INCLUDE1)/xalloc.h \
$(INCLUDE1)/xerror.h \
$(INCLUDE1)/zalloc.h \
$(INCLUDE1)/zerror.h
zalloc_ext.o: $(KOLAN_INCLUDE)/zalloc_ext.c $(KOLAN_INCLUDE)/zalloc_ext.h \
$(KOLAN_INCLUDE)/zalloc.h $(KOLAN_INCLUDE)/xerror.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
zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h $(KOLAN_INCLUDE)/xerror.h
xalloc.o: \
$(INCLUDE1)/xalloc.c \
$(INCLUDE1)/xalloc.h \
$(INCLUDE1)/xerror.h
xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h $(KOLAN_INCLUDE)/xerror.h
xerror.o: \
$(INCLUDE1)/xerror.c \
$(INCLUDE1)/xerror.h
zerror.o: $(KOLAN_INCLUDE)/zerror.c $(KOLAN_INCLUDE)/zerror.h $(KOLAN_INCLUDE)/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
xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h

View File

@ -21,7 +21,7 @@ FILE_NAME_0=21;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_test.c;0
FILE_NAME_1=298;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.c;0
FILE_NAME_2=0;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0
FILE_NAME_3=133;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_tags.h;0
FILE_NAME_4=1146;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0
FILE_NAME_4=276;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0
[build-menu]
NF_00_LB=_Сделать