# CC, BSD_HEADERS and AS_SRC can be overridden by the top level Makefile.
# if you want to individually compile in subdirectories, make sure you
# update the sub Makefiles accordingly.

CC = gcc
BSD_HEADERS = /usr/local/src/4.3bsd-net2-svr4/include
CFLAGS = -fpic -O -I$(BSD_HEADERS) -ansi -Dinline=__inline
# ASOBJ_EXT can be either o or o.orig (the precompiled version if you
# don't have gas installed)
ASOBJ_EXT = o

OBJ_DIR = ../../objs

.s.o:
	@cp $< x.c
	@gcc -E -traditional -I.. x.c -o x.s
	/usr/local/lib/gcc-as x.s -o $@
	@rm -f x.c x.s

OBJ =	htonl.$(ASOBJ_EXT) htons.$(ASOBJ_EXT) ntohl.$(ASOBJ_EXT) \
	ntohs.$(ASOBJ_EXT)

all: .all

.all: $(OBJ)
	(cd $(OBJ_DIR); rm -f $(OBJ))
	for i in $(OBJ); do \
	  ln -s `pwd`/$$i $(OBJ_DIR);\
	done;
	touch .all