# Makefile,v 1.5 1993/04/28 12:07:38 franktor Exp

CFLAGS	= -g
CPPFLAGS= -I../../include $(ISODEINC) -I/local/include
LIBES	= -lisode
CC	= $(PURIFY) gcc $(WARN)
WARN	= -W -Wpointer-arith -Wcast-qual -Wswitch $$W

OBJS	= sr.o ISO10163-SR-1_tables.o acserver.o $(MOVEDOBJS)
MOVEDOBJS= ../cli-util/octetstring.o
# MOVEDOBJS skal fjernes, men beholder dem forel|pig

all:	../libsr_isode.a;

clean:	
	-rm -f ISO10163-SR-1[-_]*.* *.ph *.[ao] #*# *~ core *.log a.out

asn1:	ISO10163-SR-1_tables.o asn1.o SR.h
	$(CC) $(CFLAGS) -o asn1 asn1.o ISO10163-SR-1_tables.o $(LIBES)

ISO10163-SR-1_tables.o:	ISO10163-SR-1_tables.c ISO10163-SR-1-types.h SR.h

ISO10163-SR-1_tables.c:	SR.py Makefile
	pepsy -A -a -f -h SR.py

sr.o:	sr.c ISO10163-SR-1_tables.c ../../include/sr-api.h ../../include/sr-low.h sr_macroes_cpp.h

sr:	sr.o
	$(CC) $(CFLAGS) -o sr sr.o ISO10163-SR-1_tables.o $(LIBES)

../libsr_isode.a:	$(OBJS)
	-rm -f libtmp.a 
	ar r libtmp.a $(OBJS)
	ranlib libtmp.a && mv libtmp.a $@

sr_macroes_cpp.h: sr_macroes.h
	-rm -f tmp.h tmp.h.BAK $@
	gcc -E sr_macroes.h > tmp.h && mv tmp.h $@
# Remove '# line' lines.  Dont use grep, it fails on too long lines.
# Since we are perling anyway, also insert some newlines that indent miss.
	perl -ne 'if(!/^#/) { s/;[ \t]*}/$$&\n/g; print; }' $@ > tmp.h
	indent -bl -pcs -i3 -sob tmp.h && mv tmp.h $@
	-@rm -f tmp.h.BAK

precpp: force
	-@rm sr_macroes_cpp.h
	$(MAKE) $(MFLAGS) sr_macroes_cpp.h

force:

install:

proto: srproto.h

srproto.h: sr.c
	cextract +Ap $(CPPFLAGS) sr.c | grep -v \#\# > tmp.h && mv tmp.h $@

depend:
#	makedepend -s "# DO NOT DELETE" -- $(CPPFLAGS) -- $(SRCS)

.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

# DO NOT DELETE
