# build dynamically loaded lib libsample.dl using libfunc.a

target: libsample.dl

# func1() and func2() is located in libfunc.a
# -lm for func1() and func2() using functions in lib libm.so
libsample.dl: sample_chdl.o func3_chdl.o libfunc.a
	ch dllink libsample.dl sample_chdl.o \
                  func3_chdl.o  libfunc.a -lm
sample_chdl.o:  sample_chdl.c
	ch dlcomp libsample.dl sample_chdl.c -I../src
func3_chdl.o:  handmade/sample/func3_chdl.c
	ch dlcomp libsample.dl handmade/sample/func3_chdl.c -I../src
libfunc.a: ../src/func.c
	cc -c ../src/func.c  -I../src
	ar -r libfunc.a func.o
	ranlib libfunc.a
clean:
	rm -f *.o *.dl libfunc.a

