trying to make include and source directories
1 files modified
1 files added
| | |
| | | CC=gcc |
| | | OBJ=main.o dns.o |
| | | DEPS=dns.h |
| | | CFLAGS=-g |
| | | _OBJ=main.o dns.o |
| | | _DEPS=dns.h |
| | | IDIR=include |
| | | CFLAGS=-I$(IDIR) -Wall -g |
| | | ODIR=obj |
| | | SRCDIR=src |
| | | |
| | | default: all |
| | | DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) |
| | | OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) |
| | | |
| | | %.o: %.c $(DEPS) |
| | | default: a.out |
| | | |
| | | %.o: %c $(DEPS) |
| | | $(CC) $(CFLAGS) -c -o $@ $< |
| | | |
| | | all: $(OBJ) |
| | | $(CC) $(CFLAGS) $^ |
| | | a.out: $(_OBJ) |
| | | $(CC) $(CFLAGS) -o $@ $^ |
| | | |
| | | .PHONY: clean |
| | | clean: |
| | | rm -rf *.o *~ |
New file |
| | |
| | | // DNS resource records |
| | | #define T_A 1 // IPv4 address |
| | | #define T_NS 2 // Name Server |
| | | #define T_CNAME 5 // Cannonical name |
| | | #define T_SOA 6 // State of Authority |
| | | #define T_PTR 12 // Domain name pointer |
| | | #define T_MX 15 // Mail exchange |
| | | #define T_TXT 16 // Text record |
| | | #define T_AAAA 28 // IPv6 address |
| | | |
| | | void resolve(unsigned char* buf, char* hostname, char* dns_ip, int query_type); |
| | | void print_packet(unsigned char* buf); |