PROGS=
PROGS_MOD=lkst_mod_stacktrace.o lkst_mod_pmc.o lkst_mod_light.o
PROGS_PL=lkst_mod_stacktrace_read.pl

all: $(PROGS) $(PROGS_MOD)

install: $(PROGS) $(PROGS_PL) $(PROGS_MOD)
	mkdir -p $(SBINDIR)
	for p in $(PROGS) $(PROGS_PL); do \
	  install -c -m 755 $$p $(SBINDIR)/$$p; \
	done;
	mkdir -p $(KMODDIR)/kernel/drivers/lkst;
	for p in $(PROGS_MOD); do \
	  install -c -m 644 $$p $(KMODDIR)/kernel/drivers/lkst/$$p; \
	done

uninstall:
	for p in $(PROGS) $(PROGS_PL); do \
	  rm -f $(SBINDIR)/$$p; \
	done
	for p in $(PROGS_MOD); do \
	  rm -f $(KMODDIR)/kernel/drivers/lkst/$$p; \
	done

clean :
	-rm -f $(PROGS) *.o core

distclean: clean
	-rm -f config.* *~ Makefile configure .config

lkst_mod_stacktrace.o: lkst_mod_stacktrace.c
	$(CC) $(CFLAGS) $(CFLAGS_KMODULE) -c -o $@ $*.c

lkst_mod_pmc.o: lkst_mod_pmc.c
	$(CC) $(CFLAGS) $(CFLAGS_KMODULE) -c -o $@ $*.c

lkst_mod_light.o: lkst_mod_light.c
	$(CC) $(CFLAGS) $(CFLAGS_KMODULE) -c -o $@ $*.c
