#pragma ident "@(#) makefile 1.0.2 2009.07.28,09:40"
# makefile
#		%Z% %M% %I% %D% %T%
#
#
# ロードモジュール名
TARGET0	= cmsmenu
TARGET1	= cmsfiler
TARGET2	= popmsg
TARGET3	= errmsg
TARGET4	= inpmsg
TARGET5	= inpmsg2
TARGET6	= dialogmsg
TARGET7	= cmslistbox
TARGET8	= listbox

OFILES  = $(OBJ)/cmsmenu.o

SRC	= .
OBJ	= .
INCLUDE	= .

LOAD = ${CMSPATH}/bin

CC	= gcc

# for Debug
#CFLAGS	= -g -X a $(INC_OPT)

# for Release (-xcg92: use SPARC Version8 instructions.)
CFLAGS	= -ggdb -O3

LDEXE	= .

LINTFLAGS = -x $(INC_OPT) $(CDEFS)

#ALL : $(LDEXE)/$(TARGET1)

#cmsmenu : $(LDEXE)/$(TARGET1)
#popmsg : $(LDEXE)/$(TARGET2)
#errmsg : $(LDEXE)/$(TARGET3)
#inpmsg : $(LDEXE)/$(TARGET4)
#inpmsg2 : $(LDEXE)/$(TARGET5)
#dialogmsg : $(LDEXE)/$(TARGET6)
#cmslistbox : $(LDEXE)/$(TARGET7)
#listbox : $(LDEXE)/$(TARGET8)

$(LDEXE)/$(TARGET0) : $(OBJ)/cmsmenu.o
	$(CC) $(CFLAGS) $(OBJ)/cmsmenu.c -o $@ -lncursesw

$(LDEXE)/$(TARGET1) : $(OBJ)/cmsfiler.c
#	$(CC) $(CFLAGS) cmsfiler.c -o cmsfiler -o $@ ../libsubform/libsubform.a -lncursesw
	gcc -I../libsubform -c cmsfiler.c
	gcc -O -o cmsfiler cmsfiler.o ../libsubform/libsubform.a -lncursesw

$(OBJ)/cmsmenu : $(SRC)/cmsmenu.o
#	$(CC) $(CFLAGS) -o $@ $(SRC)/cmsmenu.c -lncursesw


$(LDEXE)/$(TARGET2) : $(OBJ)/popmsg.o
	$(CC) $(CFLAGS) $(OBJ)/popmsg.c -o $@ -lncursesw

$(OBJ)/popmsg : $(SRC)/popmsg.o
#	$(CC) $(CFLAGS) -o $@ $(SRC)/popmsg.c -lncursesw


$(LDEXE)/$(TARGET3) : $(OBJ)/errmsg.o
	$(CC) $(CFLAGS) $(OBJ)/errmsg.o -o $@ -lncursesw

$(OBJ)/errmsg.o : $(SRC)/errmsg.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/errmsg.c


$(LDEXE)/$(TARGET4) : $(OBJ)/inpmsg.o
	$(CC) $(CFLAGS) $(OBJ)/inpmsg.o -o $@ -lncursesw

$(OBJ)/inpmsg.o : $(SRC)/inpmsg.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/inpmsg.c


$(LDEXE)/$(TARGET5) : $(OBJ)/inpmsg2.o
	$(CC) $(CFLAGS) $(OBJ)/inpmsg2.o -o $@ -lncursesw

$(OBJ)/inpmsg2.o : $(SRC)/inpmsg2.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/inpmsg2.c

$(LDEXE)/$(TARGET6) : $(OBJ)/dialogmsg.o
	$(CC) $(CFLAGS) $(OBJ)/dialogmsg.c -o $@ -lncursesw

$(OBJ)/dialogmsg.o : $(SRC)/dialogmsg.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/dialogmsg.c

$(LDEXE)/$(TARGET7) : $(OBJ)/cmslistbox.o
	$(CC) $(CFLAGS) $(OBJ)/cmslistbox.c -o $@ -lncursesw

$(LDEXE)/$(TARGET8) : $(OBJ)/listbox.o
	$(CC) $(CFLAGS) $(OBJ)/listbox.o -o $@ -lncursesw

$(OBJ)/listbox.o : $(SRC)/listbox.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/listbox.c -lncursesw

#----------------------------------------------------------
$(OBJ)/cmsctl.o : $(SRC)/cmsctl.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/cmsctl.c

$(OBJ)/quectrl.o : $(SRC)/quectrl.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/quectrl.c

$(OBJ)/suectrl.o : $(SRC)/suectrl.c
	$(CC) -c $(CFLAGS) -o $@ $(SRC)/suectrl.c

lint:	;
	lint $(LINTFLAGS) $(SRC)/cmsmenu.c

clean	:
	-rm -f $(OFILES) $(LDEXE)/$(TARGET1)

install	:
	cp -p $(LDEXE)/cmsmenu $(LOAD)

