Makefile 944 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ## Temelia, C generic data structures library
  2. # Samples for temelia, generic data structures library.
  3. CC = $(CROSS_COMPILE)gcc
  4. AR = $(CROSS_COMPILE)ar
  5. LD = $(CROSS_COMPILE)ld
  6. CFLAGS = -g -Wall -ltemelia -lm -O2
  7. CROSS_FLAGS= -Wall -O2 -DDLL -L. -I/usr/include/
  8. SAMPLES_BIN=temelia_samples
  9. SAMPLES_EXE=temelia_samples.exe
  10. # Test sources folder
  11. SRCDIR = src
  12. # Object files
  13. OBJS = $(shell ls $(SRCDIR)/*.c|tr '\n' ' '|sed -n -e s/\\.c/.o/gp)
  14. # what to build: an executable capable of loading data structures tests
  15. all: $(SAMPLES_BIN)
  16. $(SAMPLES_BIN): $(OBJS)
  17. ifeq ($(CC), gcc)
  18. $(CC) $(CFLAGS) $(OBJS) -o $(SAMPLES_BIN)
  19. else
  20. $(CC) -o $(SAMPLES_EXE) $(OBJS) $(CROSS_FLAGS) -lm -ltemelia
  21. endif
  22. # given an object ($@) that has a corresponding C source ($<), build it
  23. .c.o:
  24. ifeq ($(CC), gcc)
  25. $(CC) $(CFLAGS) -c "$<" -o "$@"
  26. else
  27. $(CC) $(CROSS_FLAGS) -c "$<" -o "$@"
  28. endif
  29. .PHONY: clean
  30. clean:
  31. -rm -rf $(SAMPLES_BIN) $(SAMPLES_EXE) $(OBJS)