TRUE Makefile and defines

This commit is contained in:
Kolan Sh 2011-07-01 15:16:59 +04:00
parent 7c33ca7e39
commit 6c846ba6db
3 changed files with 66 additions and 38 deletions

View File

@ -1,9 +1,16 @@
#_________________________________
# ENVIRONMENT |
#________________________________|
CC=cc
CXX=c++
INCLUDE=-I$(HOME)/projects/include
KOLAN_PROJECTS=$(HOME)/projects
KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include
LIBRARIES=
#-lexpat $(shell pkg-config --cflags liblist)
TARGET=tex_parser_test
#_______________________________________
# BUILD SCRIPT (don't change) |
#_______________________________________|
# Compiler flags
# if mode variable is empty, setting debug build mode
ifeq ($(mode),)
@ -27,11 +34,9 @@ ifeq ($(mode),release)
endif
CFLAGS += -Wall
#~ $(shell pkg-config --cflags liblist)
LDFLAGS += -Wall
#~ $(shell pkg-config --libs liblist) -lpthread -lexpat
LDFLAGS += -Wall $(LIBRARIES)
all: tex_parser_test
all: $(TARGET)
ifneq ($(mode),debug)
ifneq ($(mode),profile)
@ -51,27 +56,51 @@ endif
@echo ".........................."
%.o :
$(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $<
tex_parser_test_obj = tex_parser_test.o tex_parser.o zalloc_ext.o zalloc.o xalloc.o zerror.o xerror.o
tex_parser_test: $(tex_parser_test_obj)
$(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(tex_parser_test_obj)
tex_parser_test.o: tex_parser_test.c tex_parser.o
tex_parser.o: tex_parser.c tex_parser.h zalloc_ext.o zalloc.o xalloc.o zerror.o
zalloc_ext.o: $(KOLAN_INCLUDE)/zalloc_ext.c $(KOLAN_INCLUDE)/zalloc_ext.h zalloc.o xerror.o
zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h xerror.o
xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h xerror.o
zerror.o: $(KOLAN_INCLUDE)/zerror.c $(KOLAN_INCLUDE)/zerror.h
xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h
$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
clean:
$(RM) *.o *.out callgrind.out.* *.gcno tex_parser_test
$(RM) *.o *.out callgrind.out.* *.gcno $(TARGET)
.PHONY: all clean
#_________________________________
# R U L E S |
#________________________________|
KOLAN_PROJECTS=$(HOME)/projects
KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include
target_objs = tex_parser_test.o tex_parser.o tex_parser_table.o tex_parser_graphics.o \
zalloc_ext.o zalloc.o xalloc.o zerror.o xerror.o
$(TARGET): $(target_objs)
$(CC) $(LDFLAGS) -o $@ $(target_objs)
tex_parser_test.o: tex_parser_test.c tex_parser.c tex_parser.h \
tex_parser_table.h tex_parser_graphics.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_table.h tex_parser_graphics.h \
$(KOLAN_INCLUDE)/xerror.h $(KOLAN_INCLUDE)/zerror.h \
$(KOLAN_INCLUDE)/xalloc.h $(KOLAN_INCLUDE)/zalloc.h $(KOLAN_INCLUDE)/zalloc_ext.h
tex_parser_table.o: tex_parser_table.c tex_parser_table.h \
$(KOLAN_INCLUDE)/xerror.h $(KOLAN_INCLUDE)/zerror.h \
$(KOLAN_INCLUDE)/xalloc.h $(KOLAN_INCLUDE)/zalloc.h \
$(KOLAN_INCLUDE)/zalloc_ext.h
tex_parser_graphics.o: tex_parser_graphics.c tex_parser_graphics.h \
$(KOLAN_INCLUDE)/xerror.h $(KOLAN_INCLUDE)/zerror.h \
$(KOLAN_INCLUDE)/xalloc.h $(KOLAN_INCLUDE)/zalloc.h \
$(KOLAN_INCLUDE)/zalloc_ext.h
zalloc_ext.o: $(KOLAN_INCLUDE)/zalloc_ext.c $(KOLAN_INCLUDE)/zalloc_ext.h \
$(KOLAN_INCLUDE)/zalloc.h $(KOLAN_INCLUDE)/xerror.h
zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h $(KOLAN_INCLUDE)/xerror.h
xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h $(KOLAN_INCLUDE)/xerror.h
zerror.o: $(KOLAN_INCLUDE)/zerror.c $(KOLAN_INCLUDE)/zerror.h $(KOLAN_INCLUDE)/xerror.h
xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h

View File

@ -1,16 +1,15 @@
#ifndef _TEX_PARSER_TAGS_H
#define _TEX_PARSER_TAGS_H
const char * const TEX_TAG_BEGIN = "begin";
const char * const TEX_TAG_CLINE = "cline";
const char * const TEX_TAG_END = "end";
const char * const TEX_TAG_ENDFOOT = "endfoot";
const char * const TEX_TAG_ENDHEAD = "endhead";
const char * const TEX_TAG_HLINE = "hline";
const char * const TEX_TAG_HSPACE = "hspace";
const char * const TEX_TAG_MULTICOLUMN = "multicolumn";
const char * const TEX_TAG_MULTIROW = "multirow";
const char * const TEX_TAG_TABULARNEWLINE = "tabularnewline";
const char * const TEX_TAG_SLASH = "\\";
#define TEX_TAG_BEGIN "begin"
#define TEX_TAG_CLINE "cline"
#define TEX_TAG_END "end"
#define TEX_TAG_ENDFOOT "endfoot"
#define TEX_TAG_ENDHEAD "endhead"
#define TEX_TAG_HLINE "hline"
#define TEX_TAG_HSPACE "hspace"
#define TEX_TAG_MULTICOLUMN "multicolumn"
#define TEX_TAG_MULTIROW "multirow"
#define TEX_TAG_TABULARNEWLINE "tabularnewline"
#endif

View File

@ -43,7 +43,7 @@ int main(int argc, char *argv[])
printf("Parsing error at %d, symb=%c: %s\n", error.code + 1, tex_buf[error.code], error.message);
}
tex_buf = xfree_null(tex_buf);
xclear(&tex_buf);
return EXIT_SUCCESS;
}