LIB = xaal_aux DEMO = xaal_aux DEMOS = dummyLamp_aux INSTALL_DIR = /usr/local CFLAGS = -Wall -I. -g -O0 LDFLAGS = LOADLIBES = -L. -lxaal -lcbor -luuid -lsodium -l$(LIB) -lmnl INSTALL= install -c all: lib$(LIB).a lib$(LIB).so $(DEMOS) $(DEMO) lib$(LIB).a: lib$(LIB).o $(AR) rc $@ $^ lib$(LIB).so: lib$(LIB).c $(CC) $(CFLAGS) $< $(LDFLAGS) -fPIC -shared -o $@ $(DEMOS): lib$(LIB).so clean: -rm -f *.o *~ proper: clean -rm -f lib$(LIB).a lib$(LIB).so $(DEMOS) $(DEMO) install: lib$(LIB).a lib$(LIB).so $(LIB).h $(INSTALL) -d $(INSTALL_DIR) $(INSTALL) -m 0755 -s lib$(LIB).so $(INSTALL_DIR)/lib/ $(INSTALL) -m 0644 -s lib$(LIB).a $(INSTALL_DIR)/lib/ $(INSTALL) -m 0644 $(LIB).h $(INSTALL_DIR)/include/ ldconfig $(INSTALL_DIR)/lib/ SHELL = /bin/bash test: all @echo " " You can test $(DEMOS) @echo " " First, do: export LD_LIBRARY_PATH+=:. @echo " " Then, eg.: @/bin/echo -e "" $(foreach i,$(DEMOS)," ./$(i) -a 224.0.29.200 -p 1236 -s my_secret\n") Makefile.dep: lib$(LIB).c $(DEMOS:=.c) $(DEMO).c $(CC) $(CFLAGS) -MM $^ > $@ include Makefile.dep .PHONY: all clean proper install test .SUFFIXES: .a .svnignore: echo lib$(LIB).a lib$(LIB).so lib$(LIB).o $(DEMOS) $(DEMOS:=.o) $(DEMO) $(DEMO).o | tr ' ' '\012' > $@ svnignore: .svnignore svn propset svn:ignore -F $< .