Advertisement
Guest User

Untitled

a guest
Jun 8th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.00 KB | None | 0 0
  1. # client/Makefile
  2. CC = gcc
  3. CFLAGS = -Wall -ggdb -Iinclude -I../common/include
  4. LDFLAGS = -lm `pkg-config --libs wayland-client`
  5.  
  6. HDR = include/xdg-shell-server.h
  7. OBJ = $(wildcard ../common/build/*.o)
  8. PRE = include/xdg-shell-server.h
  9. OUT = ../wlclient
  10.  
  11. include/xdg-shell-client.h: $(XDG_PROTO)
  12.     wayland-scanner client-header $< $@
  13.  
  14. include ../common/gener.mk
  15.  
  16. test: all
  17.     xterm -e $(OUT)
  18.  
  19. .PHONY: test
  20.  
  21. # common/gener.mk
  22. SRC += $(wildcard src/*.c)
  23. HDR += $(wildcard include/*.h)
  24.  
  25. OBJ += $(subst src, build, $(SRC:.c=.o))
  26. DEP = $(subst src, build, $(SRC:.c=.d))
  27.  
  28. all: $(PRE) $(DEP) $(OUT)
  29.  
  30. ifneq ($(OUT),)
  31. $(OUT): $(OBJ)
  32.     $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
  33. endif
  34.  
  35. build/%.d: src/%.c
  36.     $(CC) $(CFLAGS) -MM $< | sed -e "s/^[^ \t]\+\.o:/build\/&/" > $@
  37.  
  38. build/%.o: src/%.c build/%.d
  39.     $(CC) $(CFLAGS) -c $< -o $@
  40.  
  41. clean:
  42.     rm -f $(OBJ) $(OUT)
  43.  
  44. fullclean: clean
  45.     rm -f $(DEP)
  46.  
  47. .PHONY: clean fullclean all
  48. .SECONDARY: $(DEP)
  49.  
  50. ifneq "$(MAKECMDGOALS)" "clean"
  51. include $(DEP)
  52. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement