mirror of
https://github.com/opus-tango/http-server-in-c.git
synced 2026-03-20 03:55:25 +00:00
rewrite makefile to handle all the files with pattern matching
This commit is contained in:
49
Makefile
49
Makefile
@@ -1,20 +1,43 @@
|
|||||||
all: webserver.o client_handler.o request_handler.o http_stuff.o
|
# Compiler and flags
|
||||||
gcc -o webserver.out *.o -lpthread
|
CC = gcc
|
||||||
|
DEBUG_FLAGS = -g -Wall -Wextra
|
||||||
|
RELEASE_FLAGS = -Wall -Wextra
|
||||||
|
LFLAGS = -lpthread
|
||||||
|
|
||||||
debug:
|
# Source files
|
||||||
gcc -g -o webserver.out webserver.c client_handler.h client_handler.c request_handler.h request_handler.c http_stuff.h http_stuff.c -lpthread
|
SRCS = webserver.c client_handler.c request_handler.c http_stuff.c
|
||||||
|
|
||||||
webserver: webserver.c
|
# Object files definition
|
||||||
gcc -c webserver webserver.c
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
client_handler: client_handler.c client_handler.h request_handler.h
|
TARGET = webserver.out
|
||||||
gcc -c client_handler client_handler.c
|
|
||||||
|
|
||||||
request_handler: request_handler.c request_handler.h http_stuff.h
|
|
||||||
gcc -c request_handler request_handler.c
|
|
||||||
|
|
||||||
http_stuff: http_stuff.c http_stuff.h
|
# BUILD STUFF
|
||||||
gcc -c http_stuff http_stuff.c
|
|
||||||
|
# Default to debug
|
||||||
|
all: debug
|
||||||
|
|
||||||
|
debug: CFLAGS = $(DEBUG_FLAGS)
|
||||||
|
debug: $(TARGET)
|
||||||
|
|
||||||
|
release: CFLAGS = $(RELEASE_FLAGS)
|
||||||
|
release: $(TARGET)
|
||||||
|
|
||||||
|
# Link object files
|
||||||
|
$(TARGET): $(OBJS)
|
||||||
|
$(CC) -o $(TARGET) $(OBJS) $(LFLAGS)
|
||||||
|
|
||||||
|
# Compile object files
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
# Object dependencies
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o *.out
|
rm -f $(OBJS)
|
||||||
|
rm -f $(TARGET)
|
||||||
|
|
||||||
|
.PHONY: all debug release clean
|
||||||
@@ -14,7 +14,7 @@ I also plan to publish this as a portfolio project for my resume.
|
|||||||
- [x] Get url parsing working
|
- [x] Get url parsing working
|
||||||
- [x] Fix existing bugs in socket handling and TCP buffering
|
- [x] Fix existing bugs in socket handling and TCP buffering
|
||||||
- [x] Finish code to parse HTTP requests
|
- [x] Finish code to parse HTTP requests
|
||||||
- [ ] Update makefile to be more flexible
|
- [x] Update makefile to be more flexible
|
||||||
- [ ] Finish code to build HTTP responses
|
- [ ] Finish code to build HTTP responses
|
||||||
- [ ] Get html file serving working
|
- [ ] Get html file serving working
|
||||||
- [ ] Implement file uploads (with restricted file types)
|
- [ ] Implement file uploads (with restricted file types)
|
||||||
|
|||||||
Reference in New Issue
Block a user