Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright (C) 2018-2025 Ruilin Peng (Nick) <[email protected]>.
  2. #
  3. # smartdns is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # smartdns is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. BIN=smartdns_demo.so
  16. OBJS_MAIN=$(patsubst %.c,%.o,$(wildcard *.c))
  17. OBJS=$(OBJS_MAIN)
  18. # cflags
  19. ifndef CFLAGS
  20. ifdef DEBUG
  21. CFLAGS = -g -DDEBUG
  22. else
  23. CFLAGS = -O2
  24. endif
  25. CFLAGS +=-fPIC -Wall -Wstrict-prototypes -fno-omit-frame-pointer -Wstrict-aliasing -funwind-tables -Wmissing-prototypes -Wshadow -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough
  26. endif
  27. override CFLAGS +=-Iinclude -I../../src/include -I../../src
  28. override CFLAGS += -DBASE_FILE_NAME='"$(notdir $<)"'
  29. override CFLAGS += $(EXTRA_CFLAGS)
  30. override LDFLAGS += -lpthread -shared
  31. .PHONY: all clean
  32. all: $(BIN)
  33. $(BIN) : $(OBJS)
  34. $(CC) $(OBJS) -o $@ $(LDFLAGS)
  35. clean:
  36. $(RM) $(OBJS) $(BIN)