-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
61 lines (49 loc) · 1.11 KB
/
Makefile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
CFLAGS?=-O3 -Wunused-result
HTTPOBJ = httppil.o http.o httpxml.o httphandler.o httppost.o httpauth.o
HEADERS = httpint.h httpapi.h httpxml.h
ifndef TARGET
TARGET = miniweb
HTTPOBJ += miniweb.o
endif
DEFINES=
ifdef WINDIR
DEFINES+= -DWIN32
LDADD += -lws2_32 -lshell32 -liphlpapi
OS="Win32"
else
#CFLAGS+= -fPIC
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
OS="Darwin"
else
LDADD += -lrt
OS="Linux"
CFLAGS+= -DHAS_POSIX_TIMERS
endif
endif
ifndef DEBUG
DFLAGS += -s
else
DEFINES+= -DHTTP_DEBUG
LDFLAGS += -g
endif
ifdef ENABLE_SERIAL
HTTPOBJ+= httpserial.o libctb/src/fifo.o libctb/src/serportx.o
HEADERS+= httpserial.h
DEFINES+= -Ilibctb/include
endif
%.o: %.c $(HEADERS)
$(CC) $(DEFINES) -c -o $@ $(CFLAGS) $(filter %.c, $^)
all: $(HTTPOBJ)
@echo Building for $(OS)
$(CC) $(LDFLAGS) $(HTTPOBJ) $(LDADD) -o $(TARGET)
min: $(HTTPOBJ) httpmin.o
@echo Building for $(OS)
$(CC) $(LDFLAGS) $(HTTPOBJ) httpmin.o $(LDADD) -o httpd
install: all
@rm -f /usr/bin/$(TARGET)
@cp $(TARGET) /usr/bin
clean:
@rm -f $(TARGET) $(TARGET).exe
@rm -f *.o
@rm -rf Debug Release