summaryrefslogtreecommitdiff
path: root/server/Makefile
blob: 24cf554a6f7dceda2daf15c70b8da0cc4c6d4ce6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -g -O2 -fwrapv -I..
LDFLAGS = -lz
TARGET = pstat

OBJDIR = obj

.PHONY: all clean

.SUFFIXES:

all: $(TARGET)

clean:
	@echo "Cleaning"
	@rm -f $(TARGET)
	@rm -rf $(OBJDIR)


$(OBJDIR)/%.o: %.c $(wildcard *.h)
	@mkdir -p $(OBJDIR)
	@echo "CC $<"
	@$(CC) $(CFLAGS) -c -o $@ $<

$(TARGET): $(patsubst %.c,$(OBJDIR)/%.o,$(wildcard *.c))
	@make -q -C .. || make -C .. --no-print-directory
	@echo "LD -o $@"
	@$(CC) -o $@ $^ $(wildcard ../$(OBJDIR)/*.o) $(LDFLAGS)