# Makefile for installation program of Smart BootManager 3.0 

BIN_DIR_LINUX=/usr/sbin/
BIN_DIR_DOS=../release
CC= gcc
OPTIONS= -g
INCLUDE= ./
MANAGER_INCLUDES= loader.h main.h theme-us.h theme-zh.h
MANAGER_BIN_FILES= ../manager/loader.bin\
	../manager/main.bin\
	../manager/theme-us.bin\
	../manager/theme-zh.bin

all:
	@echo "usage: make [target]"
	@echo "where target can be linux or dos"

.c.o:
	${CC} ${OPTIONS} -c $<

linux: convert convert_mgr_linux sbminst

dos: convert.exe convert_mgr_dos sbminst.exe

convert: convert.o
	${CC} ${OPTIONS} -o convert convert.o

convert.exe: convert.o
	${CC} ${OPTIONS} -o convert.exe convert.o

sbminst: sbminst.o
	${CC} ${OPTIONS} -I${INCLUDE} -o sbminst sbminst.o

sbminst.exe: sbminst.o
	${CC} ${OPTIONS} -I${INCLUDE} -o sbminst.exe sbminst.o

convert_mgr_dos: ${MANAGER_BIN_FILES}
	./convert.exe

convert_mgr_linux: ${MANAGER_BIN_FILES}
	./convert

install_linux: linux
	strip sbminst
	install -m 755 sbminst ${BIN_DIR_LINUX}

install_dos: dos
	@echo "The executable file is installer/sbminst.exe,"
	@echo "copy it to any where that you want."

.PHONY: clean
clean:
	@rm -f *~ *.bin core *.out *.o *.bak *.bkp loader.h main.h theme-us.h theme-zh.h sbminst sbminst.exe convert convert.exe

convert.o: convert.c

sbminst.o: sbminst.c 
