# virus makefile - (C) 2001, 2002 Stefan Koerner <ripclaw@rocklinux.org>
#
# Do unto this makefile as you like.
#

#CFLAGS := "-Wall -O2"
#CFLAGS := "-Wall -Os"
#CFLAGS := "-Wall -O2 -fpic"
#CFLAGS := "-Wall -O2 -fexpensive-optimizations -fno-common -fverbose-asm"
#CFLAGS += "-static"
CFLAGS := "-Wall -pedantic -O2 -fexpensive-optimizations -fno-common -fverbose-asm -static"
CC := gcc $(CFLAGS)

VIRUS_VERSION := "0.0.2"
VIRUS_MAKE_BANNER := "xx VI Resembling Utility Skeleton - Version $(VIRUS_VERSION)"
banner : 
	@echo -e $(VIRUS_MAKE_BANNER)

# actual stuff doing the build:
#------------------------------

OBJECTS := virus.o
BINARY_LIST := vi virus

# create a .o file for every .c file
%.o : %.c
	gcc -c $< -o $@

virus : banner $(OBJECTS)
	@echo xx creating main binary
	$(CC) -o virus $(OBJECTS)
	cp virus vi

strip : banner virus $(OBJECTS)
	@echo xx stripping binaries
	strip virus
	strip vi

all: banner virus strip
	@echo xx done creating all files


# cleanup stuff
.PHONY : clean
clean : banner
	@echo xx cleaning up intermediate objects
	rm -f $(OBJECTS)

.PHONY : distclean
distclean : banner
	@echo xx cleaning up
	rm -f $(BINARY_LIST)
	rm -f $(OBJECTS)
	
