Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6e4e99dd760af0f3d77c72691035066d3e6cfb8c (plain) (blame)
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
29
30
31
32
33
34
35
CC=gcc
CFLAGS=-g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -Wmissing-prototypes -I. -I../../agent -I-

CFILES=$(basename $(wildcard *.c)) $(basename $(notdir $(wildcard ../../agent/*.c)))
OFILES=$(filter-out main%.o, $(addsuffix .o, $(CFILES)))
HFILES=$(wildcard *.h) $(wildcard ../../agent/*.h) Makefile
  
EXES=agent

UNAME=$(shell uname -o)

ifeq ($(UNAME),Cygwin)
LIBS=-lws2_32 -liphlpapi
else
ifeq ($(UNAME),Msys)
CFLAGS:=-mwin32 $(CFLAGS)
LIBS=-lws2_32 -liphlpapi
else
LIBS=-lpthread -lrt -lelf
endif
endif

all:	$(EXES)

agent: main.o $(OFILES)
	$(CC) $(CFLAGS) -o $@ main.o $(OFILES) $(LIBS)

%.o: %.c $(HFILES)
	$(CC) $(CFLAGS) -c -o $@ $<

%.o: ../../agent/%.c $(HFILES)
	$(CC) $(CFLAGS) -c -o $@ $<

clean:
	rm -f *.o $(EXES)

Back to the top