Makefile 4.07 KB
#############################################
#   make file for Anubis Virtual Machine
#
#
# Author: Alain Prouté
#

#
# Accessing directories. (This Makefile is in 'anubis_dev/vm/proj/linux')
#
DEVDIR = ../../..
SRCDIR = $(DEVDIR)/vm/src
TRDDIR = $(HOME)/third_dev

#
# Compiling options and where to find header files
#
OPTIMIZE = -g
INCLUDE = -I$(DEVDIR)/include -I$(SRCDIR)

#
# Object files by categories.
#
main_objs     = vmalloc.o vm.o vmtools.o graphics.o sslstuff.o time.o linuxstuff.o\
                AnubisAllocator.o AnubisFileLocker.o AnubisProcess.o IniFile.o List.o String.o\
                FileIO.o DebugLog.o StringList.o MultiPath.o syscall.o serialize.o
#                grammar.tab.o lex.yy.o
special_objs  = anbexec.o
cipher_objs   = sha1.o blowfish.o
graph_objs    = host_graph.o

sqlite3_objs = alter.o analyze.o attach.o auth.o btree.o build.o callback.o complete.o\
               date.o delete.o expr.o func.o hash.o insert.o legacy.o main.o opcodes.o\
               os_unix.o os_win.o pager.o parse.o pragma.o prepare.o printf.o random.o\
               select.o table.o tokenize.o trigger.o update.o\
               utf.o util.o vacuum.o vdbeapi.o vdbeaux.o vdbe.o vdbefifo.o vdbemem.o\
               where.o

#
# Making the virtual machine
#
all: anbexec

#
# Dependancies.
#
dependancies: $(main_objs:.o=.d) $(special_objs:.o=.d) $(cipher_objs:.o=.d) $(graph_objs:.o=.d)
dependancies_perso: $(main_objs:.o=.d) $(special_objs:.o=.perso.d) $(cipher_objs:.o=.d) $(graph_objs:.o=.d)

-include $(main_objs:.o=.d) $(special_objs:.o=.d) $(special_objs:.o=.perso.d)\
           $(cipher_objs:.o=.d) $(graph_objs:.o=.d)

#
# Making the *.d files
#
%.perso.d: $(SRCDIR)/%.c
	gcc $(INCLUDE) -MM $< > $@

%.d: $(SRCDIR)/%.c
	gcc $(INCLUDE) -MM $< > $@

%.d: $(SRCDIR)/linux/%.c
	gcc $(INCLUDE) -MM $< > $@

%.d: $(DEVDIR)/cipher/%.c
	gcc $(INCLUDE) -MM $< > $@

#
# Making object files. 
#
%.perso.o: $(SRCDIR)/%.c
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_\
          -D_CRYPTADM_ $<

%.perso.o: $(SRCDIR)/%.cpp
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_\
          -D_CRYPTADM_ $<

%.o: $(TRDDIR)/sqlite3/%.c
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -DNO_TCL $<

%.o: $(SRCDIR)/%.c
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

%.o: $(SRCDIR)/%.cpp
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

%.o: $(SRCDIR)/linux/%.c
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

%.o: $(SRCDIR)/linux/%.cpp
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

%.o: $(DEVDIR)/cipher/%.c
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

%.o: $(DEVDIR)/cipher/%.cpp
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

%.o: $(DEVDIR)/share/%.c
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

%.o: $(DEVDIR)/share/%.cpp
	gcc $(OPTIMIZE) $(INCLUDE) -o $@ -c -Wall -Wstrict-prototypes -D_LINUX_ -D_WITH_GRAPHISM_ $<

#
# Using BISON and FLEX
#
$(SRCDIR)/grammar.tab.c $(SRCDIR)/grammar.tab.h: $(SRCDIR)/grammar.y
	cd $(SRCDIR) && bison -l -v -d grammar.y

$(SRCDIR)/lex.yy.c: $(SRCDIR)/lexer.y $(SRCDIR)/grammar.tab.h
	cd $(SRCDIR) && flex lexer.y


#
#
#
#construct.c.out construct.h.out: compilertypes.anubis
#	myanubis compilertypes.anubis -dct
#
#weaktypes.c: compilertypes.anubis construct.c.out
#	mv construc.c.out weaktypes.c
#
#weaktypes.h: compilertypes.anubis construct.h.out
#	mv construc.h.out weaktypes.h

#
# Linking anbexec
#
anbexec: $(main_objs) $(special_objs) $(cipher_objs) $(graph_objs) $(sqlite3_objs)
	gcc -o anbexec $(main_objs) $(special_objs) $(cipher_objs) $(graph_objs)\
          $(sqlite3_objs) -L/usr/X11R6/lib\
          -ljpeg -lssl -lcrypto -lm -lX11 -ldl -lstdc++ -lpthread -lc
	strip anbexec
	cp anbexec $(HOME)/anubis_distrib/linux_install/bin
#	cp anbexec $(HOME)/bin/anbexec


clean:
	rm -fr *.o *.d *~