filewatcherd

FreeBSD daemon that watches files and runs commands when they change
git clone https://git.instinctive.eu/filewatcherd.git
Log | Files | Refs | README | LICENSE

Makefile (1651B)


      1 # Makefile
      2 
      3 # Copyright (c) 2009-2013, Natacha Porté
      4 #
      5 # Permission to use, copy, modify, and distribute this software for any
      6 # purpose with or without fee is hereby granted, provided that the above
      7 # copyright notice and this permission notice appear in all copies.
      8 #
      9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16 
     17 DEPDIR=depends
     18 ALLDEPS=$(DEPDIR)/all
     19 CFLAGS?=-g -O3 -Wall -Wextra -Werror
     20 LDFLAGS?=-g -O3 -Wall -Wextra -Werror
     21 CC?=gcc
     22 
     23 all:		filewatcherd
     24 
     25 .PHONY:		all clean
     26 
     27 
     28 # executables
     29 
     30 filewatcherd:	filewatcherd.o log.o run.o watchtab.o
     31 	$(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
     32 
     33 
     34 # Housekeeping
     35 
     36 clean:
     37 	rm -f *.o
     38 	rm -f filewatcherd
     39 	rm -rf $(DEPDIR)
     40 
     41 
     42 # dependencies
     43 
     44 .sinclude "$(ALLDEPS)"
     45 
     46 
     47 # generic object compilations
     48 
     49 .c.o:
     50 	@mkdir -p $(DEPDIR)
     51 	@touch $(ALLDEPS)
     52 	@$(CC) -MM $(.IMPSRC) > $(DEPDIR)/$(.PREFIX).d
     53 	@grep -q "$(.PREFIX).d" $(ALLDEPS) \
     54 			|| echo ".include \"$(.PREFIX).d\"" >> $(ALLDEPS)
     55 	$(CC) -c $(CFLAGS) -o $(.TARGET) $(.IMPSRC)
     56 
     57 .m.o:
     58 	@mkdir -p $(DEPDIR)
     59 	@touch $(ALLDEPS)
     60 	@$(CC) -MM $(.IMPSRC) > depends/$(.PREFIX).d
     61 	@grep -q "$(.PREFIX).d" $(ALLDEPS) \
     62 			|| echo ".include \"$(.PREFIX).d\"" >> $(ALLDEPS)
     63 	$(CC) -c $(CFLAGS) -o $(.TARGET) $(.IMPSRC)