#/bin/bash

CC=gcc
CFLAGS=-g -Wall -I/usr/include/mariadb
PROGS=omcCleaner


LINK.c=$(CC) $(CFLAGS)

LINKFLAG=-L../../../omcLib/c_program/omcLib -lomcLib \
-L../../../../plat/snmp/lib -lsnmp \
-L../../../../plat/sccp/lib -lsccp \
-L../../../../plat/iptrans/lib -liptrans \
-L../../../../plat/debug/lib -ldebug \
-L../../../../plat/public/lib -lpublic \
-L/usr/lib/mysql -lmariadbclient -lz \

TOTAL_OBJ=omc_cleaner_main.o omc_cleaner.o omc_task.o

default: linuxES

all:
	@echo "make clean    -- Delete the target files"
	@echo "make linuxES  -- Generate target files for Redhat Linux ES"
	
linuxES: $(TOTAL_OBJ)
	@$(LINK.c) -o $(PROGS) $(TOTAL_OBJ) $(LINKFLAG) -lm
	ar r libomcCleaner.a $(TOTAL_OBJ)
	# rm -rf *.o
	# rm -rf *bak
	# rm -rf *~	
	# cp -f $(PROGS) ../../../../bin/
	# cp -f $(PROGS) /usr/local/omc/bin/	

installbin: linuxES
	cp -f $(PROGS) ../../../../bin/

installomc: linuxES
	cp -f $(PROGS) /usr/local/omc/bin/

installall: installbin installomc


omc_cleaner_main.o: omc_cleaner_main.c
	$(LINK.c) -c omc_cleaner_main.c

omc_cleaner.o: omc_cleaner.c
	$(LINK.c) -c omc_cleaner.c

omc_task.o: omc_task.c
	$(LINK.c) -c omc_task.c

clean:
	rm -rf *.o *.a $(PROGS)	
