# 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 sample_retstruct_chdl.o func5_chdl.o libfunc.a
	ch dllink libsample.dl sample_chdl.o sample_retstruct_chdl.o \
                  func5_chdl.o  libfunc.a -lm
sample_chdl.o:  sample_chdl.c
	ch dlcomp libsample.dl sample_chdl.c -I./src
sample_retstruct_chdl.o:  sample_retstruct_chdl.c
	ch dlcomp libsample.dl sample_retstruct_chdl.c -I./src
func5_chdl.o:  func5_chdl.c
	ch dlcomp libsample.dl func5_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
	rm -f *.obj *.exp *.lib *.dll


